unit: Fix out of bounds
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 27 Aug 2018 11:37:33 +0000 (14:37 +0300)
committerhimanshu <h.himanshu@samsung.com>
Tue, 14 Jan 2020 08:53:35 +0000 (14:23 +0530)
Test /gobex/test_stream_put_req requires 5 buffers to complete.

Change-Id: I277cdcfc8c396598cb609bbf16e7944e94bc3ae0
Signed-off-by: himanshu <h.himanshu@samsung.com>
unit/util.c
unit/util.h

index 8e3115f..ce4d65a 100755 (executable)
@@ -188,6 +188,11 @@ send:
                goto failed;
        }
 
+       if (d->count >= TEST_BUF_MAX) {
+               g_print("io_cb count %u\n", d->count);
+               goto failed;
+       }
+
        if (d->recv[d->count].len < 0 || (gssize) expect_len < 0)
                return test_io_cb(io, G_IO_OUT, user_data);
 
index 6783c52..b13fd2f 100755 (executable)
@@ -19,6 +19,8 @@
  *
  */
 
+#define TEST_BUF_MAX 5
+
 enum {
        TEST_ERROR_TIMEOUT,
        TEST_ERROR_UNEXPECTED,
@@ -32,8 +34,8 @@ struct test_buf {
 struct test_data {
        guint count;
        GError *err;
-       struct test_buf recv[4];
-       struct test_buf send[4];
+       struct test_buf recv[TEST_BUF_MAX];
+       struct test_buf send[TEST_BUF_MAX];
        guint provide_delay;
        GObex *obex;
        guint id;