qmod DFU: Don't overwrite memory beyond end of usb_strings[]

The code in board_main_top() for QMOD blindly re-assigned some
members of the usb_strings[] array, writing to index 7 and 8.

However, that array only has those entries in the main firmware,
while in DFU that array has only 6 entries.  Depending on whatever
the linker has decided to put in the next memory location after
that array, we would overwrite that very early during boot-up.

Change-Id: I59e4e1a54e819808d5a8259a6d14f4b970a90020
Related: OS#4302
This commit is contained in:
Harald Welte 2019-12-06 18:45:28 +01:00
parent d70836f965
commit c9af72dccb
1 changed files with 2 additions and 0 deletions

View File

@ -332,11 +332,13 @@ void board_main_top(void)
TRACE_INFO("Detected Quad-Modem ST12\n\r");
} else {
TRACE_INFO("Detected Quad-Modem ST34\n\r");
#ifndef APPLICATION_dfu
/* make sure we use the second set of USB Strings
* calling the interfaces "Modem 3" and "Modem 4" rather
* than 1+2 */
usb_strings[7] = usb_strings[9];
usb_strings[8] = usb_strings[10];
#endif
}
/* Obtain the circuit board version (currently just prints voltage */