[CID-26106, 29538] fix buffer not null terminated issue 47/152747/1 accepted/tizen/unified/20170929.081902 submit/tizen/20170927.082657 submit/tizen/20170928.232941
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 27 Sep 2017 04:30:29 +0000 (13:30 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 27 Sep 2017 04:35:05 +0000 (13:35 +0900)
Change-Id: I8aa9202429fafdbfee845fda9c7d516a37ea1590
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
packaging/capi-network-http.spec
src/http_response.c
test/http_test.c

index 9a11214..0b3db89 100644 (file)
@@ -1,6 +1,6 @@
 Name:          capi-network-http
 Summary:       Http Framework
-Version:       0.0.28
+Version:       0.0.29
 Release:       0
 Group:         System/Network
 License:       Apache-2.0
index 29671ef..af85481 100644 (file)
@@ -38,7 +38,7 @@ void __parse_response_header(gchar *buffer, size_t written, gpointer user_data)
        __http_transaction_h* transaction = (__http_transaction_h *)user_data;
        __http_response_h*response = (__http_response_h *)transaction->response;
 
-       gchar status_code[HTTP_STATUS_CODE_SIZE] = {0, };
+       gchar status_code[HTTP_STATUS_CODE_SIZE + 1] = {0, };
        gchar* start = NULL;
        gchar* end = NULL;
 
index a0ca2eb..2142663 100644 (file)
@@ -159,7 +159,7 @@ int _write_message_body(http_transaction_h transaction, const char *file_path)
        FILE *fp;
        size_t file_size;
        size_t chunk_size = 50;
-       char *buf = malloc(chunk_size);
+       char *buf = malloc(chunk_size + 1);
 
        if (stat(file_path, &file_info) != 0) {
                ERR("stat() is failed", -1);