[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] gdbsx: malloc extra bye for null char



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1255945763 -3600
# Node ID 24dd0e4261a8aa16d3622f100b8470082ed037e5
# Parent  b84064697e4d59f379a52f1abf13ce80f78a90d8
gdbsx: malloc extra bye for null char

Signed-off-by: Mukesh Rathor <mukesh.rathor@xxxxxxxxxx>
---
 tools/debugger/gdbsx/gx/gx_comm.c |    1 +
 tools/debugger/gdbsx/gx/gx_main.c |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff -r b84064697e4d -r 24dd0e4261a8 tools/debugger/gdbsx/gx/gx_comm.c
--- a/tools/debugger/gdbsx/gx/gx_comm.c Mon Oct 19 10:48:47 2009 +0100
+++ b/tools/debugger/gdbsx/gx/gx_comm.c Mon Oct 19 10:49:23 2009 +0100
@@ -299,6 +299,7 @@ gx_putpkt (char *buf)
 
         if (write(remote_fd, buf2, p - buf2) != p - buf2) {
             perror("putpkt(write)");
+            free(buf2);
             return -1;
         }
         if (gx_remote_dbg)
diff -r b84064697e4d -r 24dd0e4261a8 tools/debugger/gdbsx/gx/gx_main.c
--- a/tools/debugger/gdbsx/gx/gx_main.c Mon Oct 19 10:48:47 2009 +0100
+++ b/tools/debugger/gdbsx/gx/gx_main.c Mon Oct 19 10:49:23 2009 +0100
@@ -201,7 +201,7 @@ process_m_request(char *remote_buf)
 
     gx_decode_m_packet(&remote_buf[1], &addr, &len);
 
-    if ((xbuf=malloc(len)) == NULL) {
+    if ((xbuf=malloc(len+1)) == NULL) {
         gx_reply_error(remote_buf);
         return;
     }
@@ -227,7 +227,7 @@ process_M_request(char *remote_buf)
 
     data_strtp = gx_decode_M_packet(&remote_buf[1], &addr, &len);
 
-    if ((xbuf=malloc(len)) == NULL) {
+    if ((xbuf=malloc(len+1)) == NULL) {
         gx_reply_error(remote_buf);
         return;
     }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.