mirror of
https://github.com/curl/curl.git
synced 2026-04-14 23:51:42 +03:00
mprintf: do not ignore length modifiers of %o, %x, %X
There are uses of `%lx` and `%zx` in the codebase, but `parsefmt` interpreted them as `%x`. Closes #15348
This commit is contained in:
parent
f901ab84e6
commit
7ca164faba
1 changed files with 18 additions and 3 deletions
|
|
@ -455,15 +455,30 @@ static int parsefmt(const char *format,
|
|||
flags |= FLAGS_UNSIGNED;
|
||||
break;
|
||||
case 'o':
|
||||
type = FORMAT_INT;
|
||||
if(flags & FLAGS_LONGLONG)
|
||||
type = FORMAT_LONGLONG;
|
||||
else if(flags & FLAGS_LONG)
|
||||
type = FORMAT_LONG;
|
||||
else
|
||||
type = FORMAT_INT;
|
||||
flags |= FLAGS_OCTAL;
|
||||
break;
|
||||
case 'x':
|
||||
type = FORMAT_INTU;
|
||||
if(flags & FLAGS_LONGLONG)
|
||||
type = FORMAT_LONGLONGU;
|
||||
else if(flags & FLAGS_LONG)
|
||||
type = FORMAT_LONGU;
|
||||
else
|
||||
type = FORMAT_INTU;
|
||||
flags |= FLAGS_HEX|FLAGS_UNSIGNED;
|
||||
break;
|
||||
case 'X':
|
||||
type = FORMAT_INTU;
|
||||
if(flags & FLAGS_LONGLONG)
|
||||
type = FORMAT_LONGLONGU;
|
||||
else if(flags & FLAGS_LONG)
|
||||
type = FORMAT_LONGU;
|
||||
else
|
||||
type = FORMAT_INTU;
|
||||
flags |= FLAGS_HEX|FLAGS_UPPER|FLAGS_UNSIGNED;
|
||||
break;
|
||||
case 'c':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue