From cc1260ee3cae505f7756003a8dc8ef73d6282c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 21 Feb 2023 10:21:07 +0800 Subject: [PATCH] FFvaluestore: fix UB reported by clang --- src/util/FFvaluestore.c | 2 +- src/util/FFvaluestore.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/FFvaluestore.c b/src/util/FFvaluestore.c index 6b0407500..68040045b 100644 --- a/src/util/FFvaluestore.c +++ b/src/util/FFvaluestore.c @@ -2,7 +2,7 @@ #include -typedef char KeyType[33]; //32 byte key + \0 +typedef char KeyType[32]; //31 byte key + \0 void ffValuestoreInit(FFvaluestore* vs, uint32_t valueSize) { diff --git a/src/util/FFvaluestore.h b/src/util/FFvaluestore.h index c59b584a6..4d966837c 100644 --- a/src/util/FFvaluestore.h +++ b/src/util/FFvaluestore.h @@ -10,7 +10,7 @@ typedef FFlist FFvaluestore; void ffValuestoreInit(FFvaluestore* vs, uint32_t valueSize); FF_C_NODISCARD void* ffValuestoreGet(FFvaluestore* vs, const char* key); -void* ffValuestoreSet(FFvaluestore* vs, const char* key, bool* created); //created may be NULL +FF_C_NODISCARD void* ffValuestoreSet(FFvaluestore* vs, const char* key, bool* created); //created may be NULL void ffValuestoreDestroy(FFvaluestore* vs); #endif