From: Alejandro Colomar Date: Sun, 25 May 2025 13:04:25 +0000 (+0200) Subject: lib/sizeof.h: Make sure STRLEN() only accepts string literals X-Git-Tag: 4.18.0-rc1~82 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15941679e32be88d577fd08cca85fc15d3daff07;p=thirdparty%2Fshadow.git lib/sizeof.h: Make sure STRLEN() only accepts string literals Link: Signed-off-by: Alejandro Colomar --- diff --git a/lib/sizeof.h b/lib/sizeof.h index ed0fc155d..6051b7777 100644 --- a/lib/sizeof.h +++ b/lib/sizeof.h @@ -21,7 +21,7 @@ #define WIDTHOF(x) (sizeof(x) * CHAR_BIT) #define SIZEOF_ARRAY(a) (sizeof(a) + must_be_array(a)) #define NITEMS(a) (SIZEOF_ARRAY((a)) / sizeof((a)[0])) -#define STRLEN(s) (NITEMS(s) - 1) +#define STRLEN(s) (NITEMS("" s "") - 1) #endif // include guard