efi/printf: Fix minor bug in precision handling

A negative precision should be ignored completely, and the presence of a
valid precision should turn off the 0 flag.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Link: https://lore.kernel.org/r/20200518190716.751506-10-nivedita@alum.mit.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Arvind Sankar 2020-05-18 15:07:01 -04:00 committed by Ard Biesheuvel
parent 3b8350959c
commit 77e48db04a

View File

@ -279,9 +279,11 @@ int vsprintf(char *buf, const char *fmt, va_list args)
++fmt;
/* it's the next argument */
precision = va_arg(args, int);
}
if (precision < 0)
} else {
precision = 0;
}
if (precision >= 0)
flags &= ~ZEROPAD;
}
/* get the conversion qualifier */