From: Seonah Moon Date: Wed, 27 Sep 2017 04:30:29 +0000 (+0900) Subject: [CID-26106, 29538] fix buffer not null terminated issue X-Git-Tag: submit/tizen/20170927.082657^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24b970fdd61a08c6ee2a7adf5b3dafb1f5dfb0af;p=platform%2Fcore%2Fapi%2Fhttp.git [CID-26106, 29538] fix buffer not null terminated issue Change-Id: I8aa9202429fafdbfee845fda9c7d516a37ea1590 Signed-off-by: Seonah Moon --- diff --git a/packaging/capi-network-http.spec b/packaging/capi-network-http.spec index 9a11214..0b3db89 100644 --- a/packaging/capi-network-http.spec +++ b/packaging/capi-network-http.spec @@ -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 diff --git a/src/http_response.c b/src/http_response.c index 29671ef..af85481 100644 --- a/src/http_response.c +++ b/src/http_response.c @@ -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; diff --git a/test/http_test.c b/test/http_test.c index a0ca2eb..2142663 100644 --- a/test/http_test.c +++ b/test/http_test.c @@ -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);