mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 18:08:23 +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:
parent
e647997236
commit
9d5ed2f9ef
@ -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'; ) {
|
for (fmt = ofmt; *fmt != '\0'; ) {
|
||||||
if (fmt[0] == '%') {
|
if (fmt[0] == '%') {
|
||||||
switch (fmt[1]) {
|
switch (fmt[1]) {
|
||||||
case '%':
|
|
||||||
case 'c':
|
case 'c':
|
||||||
|
(void)va_arg(ap, int);
|
||||||
|
FALLTHROUGH;
|
||||||
|
case '%':
|
||||||
size++;
|
size++;
|
||||||
fmt += 2;
|
fmt += 2;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user