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:
Daniel Stenberg 2002-08-23 08:29:44 +00:00
parent e6261734a0
commit af341158db

View file

@ -100,10 +100,10 @@ int vsnprintf (char *buf, int size, const char *fmt, va_list ap)
if (width > 0)
{
width -= strlen (str);
while (width-- > 0 && buf < end)
while (width-- > 0 && bp < end)
*bp++ = pad;
}
while (*str != '\0' && buf < end)
while (*str != '\0' && bp < end)
*bp++ = *str++;
}
else