bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-inetutils] [patch] in ftpd passing NULL to LOGCMD


From: Guillem Jover
Subject: [bug-inetutils] [patch] in ftpd passing NULL to LOGCMD
Date: Sat, 21 Oct 2006 16:17:56 +0300
User-agent: Mutt/1.5.13 (2006-08-11)

Hi,

Another one coming from the Coverity reports.


2006-10-21  Guillem Jover  <address@hidden>

        * ftpd/ftpd.c (store): Do not overwrite `name' with gunique's return
        value, to avoid passing NULL to LOGCMD.


Index: ftpd/ftpd.c
===================================================================
RCS file: /sources/inetutils/inetutils/ftpd/ftpd.c,v
retrieving revision 1.56
diff -u -r1.56 ftpd.c
--- ftpd/ftpd.c 12 Oct 2006 09:57:27 -0000      1.56
+++ ftpd/ftpd.c 21 Oct 2006 13:15:28 -0000
@@ -934,11 +934,17 @@
   struct stat st;
   int (*closefunc) (FILE *);
 
-  if (unique && stat (name, &st) == 0
-      && (name = gunique (name)) == NULL)
+  if (unique && stat (name, &st) == 0)
     {
-      LOGCMD (*mode == 'w' ? "put" : "append", name);
-      return;
+      const char *name_unique = gunique (name);
+
+      if (name_unique)
+        name = name_unique;
+      else
+        {
+          LOGCMD (*mode == 'w' ? "put" : "append", name);
+          return;
+        }
     }
 
   if (restart_point)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]