GNOME Bugzilla – Bug 643882
evince: off-by-one in recent afmparse.c fixes
Last modified: 2011-03-20 10:02:26 UTC
Recent afmparse.c commits to address ident buffer overflow in token() and linetoken(): http://git.gnome.org/browse/evince/commit/?id=d4139205b010 http://git.gnome.org/browse/evince/commit/?id=439c5070022e contain an off-by-one error. ident is calloc-ed to MAX_NAME size in afm_parse_file(). New condition added in the above commits restrict idx to be less than MAX_NAME before executing while loop body. idx is incremented in the body, so for oversized input, idx is MAX_NAME after the loop and the terminating 0 is written one off in ident[idx] = 0;.
Created attachment 183479 [details] [review] patch to fix the buffer overwrite
Pushed to git master, thanks!