Fix memory corruption 85/184485/1
authormk5004.lee <mk5004.lee@samsung.com>
Wed, 18 Jul 2018 04:46:03 +0000 (13:46 +0900)
committermk5004.lee <mk5004.lee@samsung.com>
Wed, 18 Jul 2018 08:13:21 +0000 (17:13 +0900)
- Check the index first.
  From patch : Fixed to allocated memory as many as deleted

Change-Id: I81f72d997645662b9f44887d8a8e70a8ac83fbbf
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
(cherry picked from commit 5061f5d9172f9fccaa1f37d228155fb8a6845a44)

src/notification_ipc.c

index 40ad1a175c8825bdccb90eba5556adddc884b823..8b9a8272669d399f5521d09bed90ecc2d3829f06 100755 (executable)
@@ -495,7 +495,7 @@ static void _delete_multiple_notify(GVariant *parameters)
                return;
        }
 
-       while (g_variant_iter_loop(iter, "(i)", &buf[idx]) && idx < num) {
+       while (idx < num && g_variant_iter_loop(iter, "(i)", &buf[idx])) {
                NOTIFICATION_DBG("priv id[%d]", buf[idx]);
                idx++;
        }