[bugfix, AS] zxbox keyboard input overflows text variable
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 086c29267c7c497e27e152e8cab1210b3875db71 Author: William Wilgus <[email protected]> Date: Thu Mar 5 01:05:34 2026 -0500 [bugfix, AS] zxbox keyboard input overflows text variable int zx_kbd_input(char* text/*, int buflen*/) is supplied with a single char by all callers thats fine till we get to here in the decode routine while (*utf8) since it just reads till it hits a 0 its probably fine but Address Sanitizer caught it make c a char array of 8 bytes to ensure a NULL Change-Id: Iad3284df34cb7451422fc96ae0bb8e159ee440b0 diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c index 6b789a84ef..6147dadcd2 100644 --- a/apps/plugins/zxbox/spmain.c +++ b/apps/plugins/zxbox/spmain.c @@ -133,7 +133,7 @@ int spcf_read_conf_file(const char *filename) /* set keys */ static void set_keys(void){ - char c; + char c[8] = {0}; int selected=0; int result; int menu_quit=0; @@ -151,31 +151,31 @@ static void set_keys(void){ case 0: if (!zx_kbd_input((char*) &c)) { - settings.keymap[0]=c; + settings.keymap[0]=c[0]; } break; case 1: if (!zx_kbd_input((char*) &c)) { - settings.keymap[1]=c; + settings.keymap[1]=c[0]; } break; case 2: if (!zx_kbd_input((char*) &c)) { - settings.keymap[2]=c; + settings.keymap[2]=c[0]; } break; case 3: if (!zx_kbd_input((char*) &c)) { - settings.keymap[3]=c; + settings.keymap[3]=c[0]; } break; case 4: if (!zx_kbd_input((char*) &c)) { - settings.keymap[4]=c; + settings.keymap[4]=c[0]; } break; default: @@ -320,7 +320,7 @@ static bool zxbox_menu(void) int result; int menu_quit=0; int exit=0; - char c; + char c[8] = {0}; MENUITEM_STRINGLIST(menu, "ZXBox", NULL, "VKeyboard", "Play/Pause Tape", "Save quick snapshot", "Load quick snapshot", @@ -338,7 +338,7 @@ static bool zxbox_menu(void) case 0: if (!zx_kbd_input((char*) &c)) { - press_key(c); + press_key(c[0]); } clear_kbd=1; menu_quit=1; -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs