2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

fmtstr: call va_arg() for %c when computing length.

Even though we don't need to read the actual char to know its length,
we do need to consume it to get the correct value for the next format.
This commit is contained in:
Todd C. Miller 2022-12-17 18:55:16 -07:00
parent e647997236
commit 9d5ed2f9ef

View File

@ -63,8 +63,10 @@ fmtstr(sudo_alloc_fn_t alloc_fn, sudo_free_fn_t free_fn, const char *ofmt, ...)
for (fmt = ofmt; *fmt != '\0'; ) {
if (fmt[0] == '%') {
switch (fmt[1]) {
case '%':
case 'c':
(void)va_arg(ap, int);
FALLTHROUGH;
case '%':
size++;
fmt += 2;
continue;