diff options
author | Jakob Kaivo <jkk@ung.org> | 2024-06-03 14:55:36 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2024-06-03 14:55:36 -0400 |
commit | d913ab781ed2426785b7ac2ebbbeaa50958a7f92 (patch) | |
tree | 6b54efa7da1786973daaff09596db6f791af33df /src/stdio/__printf.c | |
parent | b604cd380c1a974a736525b6993e9c8a5a6cf95f (diff) |
track previously converted pointers in __printf() for checking in __scanf()
Diffstat (limited to 'src/stdio/__printf.c')
-rw-r--r-- | src/stdio/__printf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/stdio/__printf.c b/src/stdio/__printf.c index 1ee488d7..05c79747 100644 --- a/src/stdio/__printf.c +++ b/src/stdio/__printf.c @@ -11,6 +11,7 @@ #endif #include "_forced/strtoumax.h" +#include "_forced/strdup.h" #include "_stdio.h" @@ -339,9 +340,11 @@ int (__printf)(struct io_options *opt, const char * format, va_list arg) UNDEFINED("In call to %s(): Precision with %%p conversion", opt->fnname); } argptr = va_arg(arg, void *); + char *s_to_track = s + nout; nout = __append(s, "0x", nout, n); __itos(numbuf, (intptr_t)argptr, ZERO, sizeof(argptr) * 2, 16); nout = __append(s, numbuf, nout, n); + ADD_PREV_STRING(s_to_track, __stdio.formatted_pointers, __stdio.nformatted_pointers); break; case 'n': /* write-back */ |