[WGID-166581] Added code for checking memory size 03/126603/1 accepted/tizen/unified/20170424.154304 submit/tizen/20170424.102709
authorSeonah Moon <seonah1.moon@samsung.com>
Mon, 24 Apr 2017 08:55:45 +0000 (17:55 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Mon, 24 Apr 2017 08:55:56 +0000 (17:55 +0900)
Change-Id: I64b27127b9d290b3791a020381f8f598ca3ca2ff
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
packaging/capi-network-http.spec
src/http_transaction.c

index d9c35e3..cce800e 100644 (file)
@@ -1,6 +1,6 @@
 Name:          capi-network-http
 Summary:       Http Framework
-Version:       0.0.21
+Version:       0.0.22
 Release:       0
 Group:         System/Network
 License:       Apache-2.0
index 9f219e1..19a5b4d 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;