[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 3/4] Paper over a stringop-overflow warning about wide char ha
From: |
Robbie Harwood |
Subject: |
[PATCH v3 3/4] Paper over a stringop-overflow warning about wide char handling |
Date: |
Wed, 5 Jan 2022 17:12:28 -0500 |
From: Peter Jones <pjones@redhat.com>
[rharwood@redhat.com: rewrote commit message]
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
lib/vasnprintf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 485745243f..122b224259 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -234,8 +234,11 @@
static size_t
local_strnlen (const char *string, size_t maxlen)
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic warning "-Wstringop-overflow"
const char *end = memchr (string, '\0', maxlen);
return end ? (size_t) (end - string) : maxlen;
+#pragma GCC diagnostic pop
}
# endif
# endif
--
2.34.1