From 408102427f872113f4da34a11172efd4bf8c7f72 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 24 Oct 2019 14:50:27 +0200 Subject: [PATCH] examples/efl_thread: fix oob writes Summary: CIDs 1403896, 1403895, 1403892 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10395 --- src/examples/ecore/efl_thread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/examples/ecore/efl_thread.c b/src/examples/ecore/efl_thread.c index 301bf5c06d..5a2ce1411a 100644 --- a/src/examples/ecore/efl_thread.c +++ b/src/examples/ecore/efl_thread.c @@ -35,7 +35,7 @@ _th_read_change(void *data EINA_UNUSED, const Efl_Event *ev) Eina_Error err = efl_io_reader_read(obj, &rw_slice); if (!err) { - buf[rw_slice.len] = 0; + buf[rw_slice.len - 1] = 0; printf("--- TH READ [%p] [%s] ok %i bytes '%s'\n", obj, efl_core_command_line_command_get(obj), (int)rw_slice.len, buf); char *buf2 = "yes-im-here "; @@ -112,7 +112,7 @@ _read_change(void *data EINA_UNUSED, const Efl_Event *ev) Eina_Error err = efl_io_reader_read(obj, &rw_slice); if (!err) { - buf[rw_slice.len] = 0; + buf[rw_slice.len - 1] = 0; printf("--- READ [%p] [%s] ok %i bytes '%s'\n", obj, efl_core_command_line_command_get(obj), (int)rw_slice.len, buf); } } @@ -146,7 +146,7 @@ _stdin_read_change(void *data EINA_UNUSED, const Efl_Event *ev) Eina_Error err = efl_io_reader_read(obj, &rw_slice); if (!err) { - buf[rw_slice.len] = 0; + buf[rw_slice.len - 1] = 0; printf("--- STDIN READ [%p] [%s] ok %i bytes '%s'\n", obj, efl_core_command_line_command_get(obj), (int)rw_slice.len, buf); } }