summaryrefslogtreecommitdiff
path: root/unit
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2018-08-27 14:37:33 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2018-08-27 14:37:33 +0300
commitc704a72ce2873bc3b272ab3edb3a78e8a11c672e (patch)
tree539d1ce490502ce8a02a8943db067d603bb618d6 /unit
parent6d2ecb1b547af21613943528b0e62a1005051eb2 (diff)
downloadbluez-c704a72ce2873bc3b272ab3edb3a78e8a11c672e.tar.gz
unit: Fix out of bounds
Test /gobex/test_stream_put_req requires 5 buffers to complete.
Diffstat (limited to 'unit')
-rw-r--r--unit/util.c5
-rw-r--r--unit/util.h6
2 files changed, 9 insertions, 2 deletions
diff --git a/unit/util.c b/unit/util.c
index 8e3115fe3..ce4d65add 100644
--- a/unit/util.c
+++ b/unit/util.c
@@ -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);
diff --git a/unit/util.h b/unit/util.h
index 6783c524e..b13fd2f16 100644
--- a/unit/util.h
+++ b/unit/util.h
@@ -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;