From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] unit: Fix out of bounds
Date: Mon, 27 Aug 2018 14:41:05 +0300 [thread overview]
Message-ID: <20180827114105.10471-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Test /gobex/test_stream_put_req requires 5 buffers to complete.
---
unit/util.c | 5 +++++
unit/util.h | 6 ++++--
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;
--
2.17.1
next reply other threads:[~2018-08-27 11:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-27 11:41 Luiz Augusto von Dentz [this message]
2018-08-31 14:26 ` [PATCH BlueZ] unit: Fix out of bounds Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180827114105.10471-1-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).