From 408959c92720d09337c5f4297c88e7820a48e844 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sun, 4 Jul 2021 00:31:16 +0200 Subject: [PATCH] Be more precise in the bound check. --- m-string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m-string.h b/m-string.h index 3bcd5eda..212037f4 100644 --- a/m-string.h +++ b/m-string.h @@ -273,7 +273,7 @@ m_str1ng_fit2size (string_t v, size_t size_alloc) /* Copy the stack allocation into the new heap allocation */ const size_t size = (size_t) v->u.stack.buffer[sizeof (string_heap_ct) - 1] + 1U; M_ASSERT( size <= alloc); - M_ASSERT( size <= sizeof (v->u.stack.buffer)); + M_ASSERT( size <= sizeof (v->u.stack.buffer)-1); memcpy(ptr, &v->u.stack.buffer[0], size); } v->ptr = ptr;