From 5ae2c9978122d549c4ee0c775899c5f2277830c4 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Fri, 10 Apr 2020 08:57:49 +0000 Subject: [PATCH] Fix the crash I just mentioned in the previous commit - don't deref past the length of option[]. --- src/uifc/uifc32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c index 1f93353836..33a2d280af 100644 --- a/src/uifc/uifc32.c +++ b/src/uifc/uifc32.c @@ -1715,7 +1715,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar case CTRL_G: if(/*!(api->mode&UIFC_NOCTRL)*/1) { // No no, *this* control key is fine! if (gotkey == CTRL_G || api->input(WIN_MID|WIN_SAV, 0, 0, "Find", search, sizeof(search), K_EDIT) > 0) { - for (j = (*cur) + 1; j != *cur; j++, j = (option[j] == NULL || !option[j][0]) ? 0 : j) { /* a = search count */ + for (j = (*cur) + 1; j != *cur; j++, j = (j >= opts) ? 0 : j) { if (strcasestr(option[j], search) != NULL) { // Copy/pasted from search above. if(y+(j-(*cur))+2>height+top) { -- GitLab