Fix message buffer usage 46/31746/1 accepted/tizen/common/20141229.125640 accepted/tizen/ivi/20150112.091035 accepted/tizen/mobile/20141230.002640 accepted/tizen/tv/20141230.002104 accepted/tizen/tv/20150127.083815 accepted/tizen/wearable/20141230.002417 submit/tizen/20141229.102225 submit/tizen_tv/20150127.081639
authorAdam Malinowski <a.malinowsk2@partner.samsung.com>
Tue, 9 Dec 2014 10:36:46 +0000 (11:36 +0100)
committerAdam Malinowski <a.malinowsk2@partner.samsung.com>
Tue, 9 Dec 2014 10:48:22 +0000 (11:48 +0100)
notification_wait_response uses uninitialized msg_buffer which
causes unexpected behaviour in subsequent calls to this function.
Problem occurs when timeout happens. In such case message_buffer
is not filled by read function and contains random data, mostly data
received in previous call to the function.

Change-Id: Ibce7e63b212d30022da277ba62cbb789df2503fd

src/notification.c

index 17b9985..799d12f 100755 (executable)
@@ -2827,7 +2827,9 @@ EXPORT_API notification_error_e notification_wait_response(notification_h noti,
        struct timeval timeout_tv;
        char *resp;
 
-        /* a response packet *must* have an execute option TYPE_RESPONDING
+       memset(msg_buffer, 0, sizeof(msg_buffer));
+
+    /* a response packet *must* have an execute option TYPE_RESPONDING
            with an associated bundle.
            If its bundle does not already contain a "tid" hint (which
            complex applications such as xwalk may overwrite), we will