Ensure we don't read beyond the end of the array of available matches. Set any remaining saved pointers to NULL.

svn path=/trunk/netsurf/; revision=7641
This commit is contained in:
John Mark Bell 2009-05-29 23:23:02 +00:00
parent cda586e6dc
commit b03d52e6d9

View File

@ -146,10 +146,16 @@ bool ro_gui_url_complete_keypress(struct gui_window *g, uint32_t key)
lines = MAXIMUM_VISIBLE_LINES;
if (lines > url_complete_matches_available)
lines = url_complete_matches_available;
if (url_complete_matches)
for (i = 0; i < MAXIMUM_VISIBLE_LINES; i++)
url_complete_redraw[i] =
if (url_complete_matches) {
for (i = 0; i < MAXIMUM_VISIBLE_LINES; i++) {
if (i < lines) {
url_complete_redraw[i] =
url_complete_matches[i];
} else {
url_complete_redraw[i] = NULL;
}
}
}
/* our selection gets wiped */
error = xwimp_force_redraw(dialog_url_complete,