Message ID | 20210209155604.6998-1-rf@opensource.cirrus.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v6,1/4] lib: vsprintf: scanf: Negative number must have field width > 1 | expand |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 3b53c73580c5..28bb26cd1f67 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -3434,8 +3434,12 @@ int vsscanf(const char *buf, const char *fmt, va_list args) str = skip_spaces(str); digit = *str; - if (is_sign && digit == '-') + if (is_sign && digit == '-') { + if (field_width == 1) + break; + digit = *(str + 1); + } if (!digit || (base == 16 && !isxdigit(digit))