Module Name:    src
Committed By:   christos
Date:           Sun Oct 21 01:11:23 UTC 2012

Modified Files:
        src/usr.bin/mail: names.c

Log Message:
PR/47098: Steffen "Daode" Nurpmeso: mail(1): SEGV with bad globbed file argument


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/mail/names.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mail/names.c
diff -u src/usr.bin/mail/names.c:1.29 src/usr.bin/mail/names.c:1.30
--- src/usr.bin/mail/names.c:1.29	Sun Apr 29 19:50:22 2012
+++ src/usr.bin/mail/names.c	Sat Oct 20 21:11:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: names.c,v 1.29 2012/04/29 23:50:22 christos Exp $	*/
+/*	$NetBSD: names.c,v 1.30 2012/10/21 01:11:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)names.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: names.c,v 1.29 2012/04/29 23:50:22 christos Exp $");
+__RCSID("$NetBSD: names.c,v 1.30 2012/10/21 01:11:23 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -266,8 +266,16 @@ outof(struct name *names, FILE *fo, stru
 		ispipe = np->n_name[0] == '|';
 		if (ispipe)
 			fname = np->n_name+1;
-		else
+		else {
 			fname = expand(np->n_name);
+			if (fname == NULL) {
+				warnx("Filename expansion of %s failed",
+				    np->n_name);
+				senderr++;
+				goto cant;
+			}
+		}
+
 
 		/*
 		 * See if we have copied the complete message out yet.

Reply via email to