From a7fb1e8d69a636e2d16674f7607e59a3d9aa0cd9 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sat, 27 Jul 2024 09:33:39 +1000 Subject: [PATCH] script: avoid gcc -Wstringop-overread for strnlen --- script/print-json-token-debug-format.c | 2 +- script/process-json-numbers.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/script/print-json-token-debug-format.c b/script/print-json-token-debug-format.c index 522e9847..7fee255e 100644 --- a/script/print-json-token-debug-format.c +++ b/script/print-json-token-debug-format.c @@ -418,7 +418,7 @@ compute_exit_code(const char* status_msg) { size_t n = strnlen(status_msg, 2047); if (n >= 2047) { status_msg = "main: internal error: error message is too long"; - n = strnlen(status_msg, 2047); + n = strlen(status_msg); } fprintf(stderr, "%s\n", status_msg); // Return an exit code of 1 for regular (foreseen) errors, e.g. badly diff --git a/script/process-json-numbers.c b/script/process-json-numbers.c index 782d3492..1e834a7b 100644 --- a/script/process-json-numbers.c +++ b/script/process-json-numbers.c @@ -307,7 +307,7 @@ compute_exit_code(const char* status_msg) { size_t n = strnlen(status_msg, 2047); if (n >= 2047) { status_msg = "main: internal error: error message is too long"; - n = strnlen(status_msg, 2047); + n = strlen(status_msg); } fprintf(stderr, "%s\n", status_msg); // Return an exit code of 1 for regular (foreseen) errors, e.g. badly