gdb_server: fix GDB_BUFFER_SIZE usage, fix unaligned access during bulk transfers
[openocd.git] / src / rtos / rtos.c
index da0a503..20e875d 100644 (file)
@@ -223,7 +223,7 @@ int rtos_qsymbol(struct connection *connection, char const *packet, int packet_s
        int rtos_detected = 0;
        uint64_t addr = 0;
        size_t reply_len;
-       char reply[GDB_BUFFER_SIZE], cur_sym[GDB_BUFFER_SIZE / 2] = "";
+       char reply[GDB_BUFFER_SIZE + 1], cur_sym[GDB_BUFFER_SIZE / 2 + 1] = ""; /* Extra byte for nul-termination */
        symbol_table_elem_t *next_sym = NULL;
        struct target *target = get_target_from_connection(connection);
        struct rtos *os = target->rtos;