From c9af72dccb47e940036136ae74bb04a312b48988 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 6 Dec 2019 18:45:28 +0100 Subject: [PATCH] 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 --- firmware/libboard/qmod/source/board_qmod.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/firmware/libboard/qmod/source/board_qmod.c b/firmware/libboard/qmod/source/board_qmod.c index 0565c92a..0b03180f 100644 --- a/firmware/libboard/qmod/source/board_qmod.c +++ b/firmware/libboard/qmod/source/board_qmod.c @@ -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 */