svn commit: r217249 - stable/8/libexec/ftpd

Ed Maste emaste at FreeBSD.org
Tue Jan 11 00:58:49 UTC 2011


Author: emaste
Date: Tue Jan 11 00:58:49 2011
New Revision: 217249
URL: http://svn.freebsd.org/changeset/base/217249

Log:
  MFC 216943, 216945:
  
    Handle failure from ftpd_popen in statfilecmd().
  
    Make format string a string literal.  (Discovered by clang.)

Modified:
  stable/8/libexec/ftpd/ftpd.c
Directory Properties:
  stable/8/libexec/ftpd/   (props changed)

Modified: stable/8/libexec/ftpd/ftpd.c
==============================================================================
--- stable/8/libexec/ftpd/ftpd.c	Tue Jan 11 00:29:17 2011	(r217248)
+++ stable/8/libexec/ftpd/ftpd.c	Tue Jan 11 00:58:49 2011	(r217249)
@@ -2133,7 +2133,7 @@ send_data(FILE *instr, FILE *outstr, siz
 				}
 			}
 			ENDXFER;
-			reply(226, msg);
+			reply(226, "%s", msg);
 			return (0);
 		}
 
@@ -2330,6 +2330,10 @@ statfilecmd(char *filename)
 	code = lstat(filename, &st) == 0 && S_ISDIR(st.st_mode) ? 212 : 213;
 	(void)snprintf(line, sizeof(line), _PATH_LS " -lgA %s", filename);
 	fin = ftpd_popen(line, "r");
+	if (fin == NULL) {
+		perror_reply(551, filename);
+		return;
+	}
 	lreply(code, "Status of %s:", filename);
 	atstart = 1;
 	while ((c = getc(fin)) != EOF) {


More information about the svn-src-all mailing list