[WGID-166581] Added code for checking memory size 17/126817/1 accepted/tizen/3.0/common/20170508.152955 accepted/tizen/3.0/mobile/20170508.050357 accepted/tizen/3.0/wearable/20170508.050418 submit/tizen_3.0-common/20170508.080135 submit/tizen_3.0-common/20170508.081301 submit/tizen_3.0-common/20170508.091535 submit/tizen_3.0/20170428.051156 submit/tizen_3.0/20170428.093500 submit/tizen_3.0_common/20170508.091735
authorSeonah Moon <seonah1.moon@samsung.com>
Mon, 24 Apr 2017 08:55:45 +0000 (17:55 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 25 Apr 2017 06:07:22 +0000 (15:07 +0900)
Change-Id: Ic95f5eb1eb8dcce2b1fee55d452447a5b04255fa
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
packaging/capi-network-http.spec
src/http_transaction.c

index 0b498606dde03026683b169dcf9288422fbdd1e2..13cfecfee9f02af1395f694cf79c3d20bb0bb3ce 100644 (file)
@@ -1,6 +1,6 @@
 Name:          capi-network-http
 Summary:       Http Framework
-Version:       0.0.20
+Version:       0.0.21
 Release:       0
 Group:         System/Network
 License:       Apache-2.0
index 9f219e1e82ec13a9e45ff017870f1b5a90d9faa7..19a5b4dec8210dd285f2bd97b9d7f03e008b5a4e 100644 (file)
@@ -119,12 +119,13 @@ size_t __handle_write_cb(gchar *ptr, size_t size, size_t nmemb, gpointer user_da
        __http_transaction_h *transaction = (__http_transaction_h *)user_data;
        __http_request_h *request = transaction->request;
        size_t body_size = 0;
+       size_t max_size = size * nmemb;
        char *data = NULL;
 
        data = (char *)g_queue_pop_head(request->body_queue);
        if (data) {
                body_size = strlen(data);
-               memcpy(ptr, data, body_size);
+               memcpy(ptr, data, (max_size > body_size) ? body_size : max_size);
        } else {
                DBG("Sent the last chunk.\n");
                return 0;