From 5a90c012e744e1915f3bfb97f74ab3a9c6aaa3ae Mon Sep 17 00:00:00 2001 From: Pierre Avital Date: Thu, 19 Oct 2023 14:24:47 +0200 Subject: [PATCH] ensure generated strings are always ASCII to respect the UTF8 requirement on selectors and keyexprs --- tests/z_msgcodec_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/z_msgcodec_test.c b/tests/z_msgcodec_test.c index dcf051d41..b56b40a9f 100644 --- a/tests/z_msgcodec_test.c +++ b/tests/z_msgcodec_test.c @@ -184,7 +184,9 @@ _z_bytes_t gen_bytes(size_t len) { if (len == 0) return arr; arr.start = (uint8_t *)z_malloc(sizeof(uint8_t) * len); - for (_z_zint_t i = 0; i < len; i++) ((uint8_t *)arr.start)[i] = gen_uint8(); + for (_z_zint_t i = 0; i < len; i++) { + ((uint8_t *)arr.start)[i] = gen_uint8() & 0b01111111; + } return arr; }