From: Mark Wielaard Date: Tue, 11 Feb 2025 13:46:44 +0000 (+0100) Subject: elflint: process_file both prefix and suffix are NULL or both are non-NULL X-Git-Tag: elfutils-0.193~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=316077dd4b34c90f7e4c4228395a580e99239347;p=thirdparty%2Felfutils.git elflint: process_file both prefix and suffix are NULL or both are non-NULL Add an assert of this property to help static analyzers (or humans) reading this code. * src/elflint.c (process_file): Add assert. Signed-off-by: Mark Wielaard --- diff --git a/src/elflint.c b/src/elflint.c index cdc6108d..a46682c7 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -252,6 +252,10 @@ process_file (int fd, Elf *elf, const char *prefix, const char *suffix, char new_suffix[(suffix == NULL ? 0 : strlen (suffix)) + 2]; char *cp = new_prefix; + /* Either both prefix and suffix are NULL or both are non-NULL. */ + assert ((prefix == NULL && suffix == NULL) + || (prefix != NULL && suffix != NULL)); + /* Create the full name of the file. */ if (prefix != NULL) {