From: AntonMoryakov <ant.v.morya...@gmail.com>

fix: fixed null pointer inference error in process_file function

Fixed a bug that could cause the program to crash when processing files without 
a suffix.
Added a NULL check for the suffix pointer before calling stpcpy().
---
 src/elflint.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/elflint.c b/src/elflint.c
index cdc6108d..14346045 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -257,7 +257,12 @@ process_file (int fd, Elf *elf, const char *prefix, const 
char *suffix,
          {
            cp = mempcpy (cp, prefix, prefix_len);
            *cp++ = '(';
-           strcpy (stpcpy (new_suffix, suffix), ")");
+               if(suffix != NULL){
+               strcpy (stpcpy (new_suffix, suffix), ")");
+               }
+               else{
+                       new_suffix[0] = '\0';
+               }
          }
        else
          new_suffix[0] = '\0';
-- 
2.34.1

Reply via email to