This is an automated email from Gerrit.

Evan Hunter ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/1312

-- gerrit

commit ab6d3f2ee17ecf6b56214685731074ce4b571fc3
Author: Evan Hunter <[email protected]>
Date:   Tue Apr 2 17:35:23 2013 +1100

    gdb server: Fix buffer overrun - sprintf appends a terminating null to the 
data which was overrunning the supplied buffer.
    
    Fixes regression introduced in commit 
07dcd5648d146d38f9ffa619f0737587e592d0b6
    
    Signed-off-by: Evan Hunter <[email protected]>
    Change-Id: Iec64233c0da5a044fb984c4b1803309cb636efe9

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index b643ae7..cb96bf2 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -978,7 +978,7 @@ static int gdb_get_registers_packet(struct connection 
*connection,
 
        assert(reg_packet_size > 0);
 
-       reg_packet = malloc(reg_packet_size);
+       reg_packet = malloc(reg_packet_size + 1); /* plus one for string 
termination null */
        reg_packet_p = reg_packet;
 
        for (i = 0; i < reg_list_size; i++) {
@@ -1085,7 +1085,7 @@ static int gdb_get_register_packet(struct connection 
*connection,
        if (!reg_list[reg_num]->valid)
                reg_list[reg_num]->type->get(reg_list[reg_num]);
 
-       reg_packet = malloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2);
+       reg_packet = malloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2 + 1); 
/* plus one for string termination null */
 
        gdb_str_to_target(target, reg_packet, reg_list[reg_num]);
 

-- 

------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to