forked from len0rd/rockbox
bad bad bad snprintf() overflow the buffer if the string passed in with a
%s didn't fit within the buffer! git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1943 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e6261734a0
commit
af341158db
1 changed files with 2 additions and 2 deletions
|
@ -100,10 +100,10 @@ int vsnprintf (char *buf, int size, const char *fmt, va_list ap)
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
{
|
{
|
||||||
width -= strlen (str);
|
width -= strlen (str);
|
||||||
while (width-- > 0 && buf < end)
|
while (width-- > 0 && bp < end)
|
||||||
*bp++ = pad;
|
*bp++ = pad;
|
||||||
}
|
}
|
||||||
while (*str != '\0' && buf < end)
|
while (*str != '\0' && bp < end)
|
||||||
*bp++ = *str++;
|
*bp++ = *str++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue