* [PATCH BlueZ] unit: Fix out of bounds
@ 2018-08-27 11:41 Luiz Augusto von Dentz
2018-08-31 14:26 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2018-08-27 11:41 UTC (permalink / raw)
To: linux-bluetooth
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH BlueZ] unit: Fix out of bounds
2018-08-27 11:41 [PATCH BlueZ] unit: Fix out of bounds Luiz Augusto von Dentz
@ 2018-08-31 14:26 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2018-08-31 14:26 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
Hi,
On Mon, Aug 27, 2018 at 2:41 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> 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
Applied.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-31 14:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-27 11:41 [PATCH BlueZ] unit: Fix out of bounds Luiz Augusto von Dentz
2018-08-31 14:26 ` Luiz Augusto von Dentz
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).