[libpng15] Fixed an out-of-range read in png_check_keyword() (Bug report

from Qixue Xiao).
This commit is contained in:
Glenn Randers-Pehrson
2015-12-09 09:40:48 -06:00
parent 93e111afc5
commit d9006f683c
3 changed files with 21 additions and 18 deletions

View File

@@ -1580,7 +1580,7 @@ png_check_keyword(png_structp png_ptr, png_const_charp key, png_charpp new_key)
{
png_warning(png_ptr, "trailing spaces removed from keyword");
while (*kp == ' ')
while (key_len && *kp == ' ')
{
*(kp--) = '\0';
key_len--;