[gnome-software/wip/attente/ubuntu-xenial: 15/27] Add NUL terminator to end of string



commit 967ba2456596d25d419fb9eb6015624fa463767d
Author: William Hua <william hua canonical com>
Date:   Sun Apr 17 16:32:58 2016 -0400

    Add NUL terminator to end of string

 src/plugins/gs-ubuntu-snapd.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-ubuntu-snapd.c b/src/plugins/gs-ubuntu-snapd.c
index a426e17..aabc9a8 100644
--- a/src/plugins/gs-ubuntu-snapd.c
+++ b/src/plugins/gs-ubuntu-snapd.c
@@ -238,8 +238,9 @@ send_snapd_request (gboolean      authenticate,
        if (response_type)
                *response_type = g_strdup (soup_message_headers_get_one (headers, "Content-Type"));
        if (response) {
-               *response = g_malloc (chunk_length + 1);
+               *response = g_malloc (chunk_length + 2);
                memcpy (*response, chunk_start, chunk_length + 1);
+               (*response)[chunk_length + 1] = '\0';
        }
        if (response_length)
                *response_length = chunk_length;


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