Fix sscanf character conversion (%c): do not add '\0' at the end as for strings, cause, for example, parsing one character will fill two bytes: character itself and zero one '\0' after it, so will overflow one byte variable argument and corrupt memory for variables allocated after it.
This commit is contained in:
parent
34bae015df
commit
d55e44b2ea
@ -574,7 +574,6 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
|
||||
if (!noassign)
|
||||
{
|
||||
strncpy(tv, buf, width);
|
||||
tv[width] = '\0';
|
||||
count++;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user