From f43ea0f91624bd797113c499405c316afdced831 Mon Sep 17 00:00:00 2001 From: Adam Malinowski Date: Tue, 9 Dec 2014 11:36:46 +0100 Subject: [PATCH] Fix message buffer usage 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/notification.c b/src/notification.c index 17b9985..799d12f 100755 --- a/src/notification.c +++ b/src/notification.c @@ -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 -- 2.7.4