Skip to content
Snippets Groups Projects
Commit bb490e59 authored by rswindell's avatar rswindell
Browse files

Fix one crash in the new Ctrl-Find feature (option lists can, unfortunately, be

terminated with a 0-length option string).
There still another crash I'm investigating that occurs if you type a string
that isn't found. It appears to deref past the end of the option array.
parent 27ab66a2
No related branches found
No related tags found
No related merge requests found
...@@ -1715,7 +1715,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -1715,7 +1715,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
case CTRL_G: case CTRL_G:
if(/*!(api->mode&UIFC_NOCTRL)*/1) { // No no, *this* control key is fine! 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) { 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 ? 0 : j) { /* a = search count */ for (j = (*cur) + 1; j != *cur; j++, j = (option[j] == NULL || !option[j][0]) ? 0 : j) { /* a = search count */
if (strcasestr(option[j], search) != NULL) { if (strcasestr(option[j], search) != NULL) {
// Copy/pasted from search above. // Copy/pasted from search above.
if(y+(j-(*cur))+2>height+top) { if(y+(j-(*cur))+2>height+top) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment