Module Name:    src
Committed By:   christos
Date:           Sat Jan 10 17:16:01 UTC 2015

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

Log Message:
fix incorrect arg size computation


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/mail/fio.c
cvs rdiff -u -r1.31 -r1.32 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/fio.c
diff -u src/usr.bin/mail/fio.c:1.41 src/usr.bin/mail/fio.c:1.42
--- src/usr.bin/mail/fio.c:1.41	Tue Dec 16 14:30:24 2014
+++ src/usr.bin/mail/fio.c	Sat Jan 10 12:16:01 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: fio.c,v 1.41 2014/12/16 19:30:24 christos Exp $	*/
+/*	$NetBSD: fio.c,v 1.42 2015/01/10 17:16:01 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)fio.c	8.2 (Berkeley) 4/20/95";
 #else
-__RCSID("$NetBSD: fio.c,v 1.41 2014/12/16 19:30:24 christos Exp $");
+__RCSID("$NetBSD: fio.c,v 1.42 2015/01/10 17:16:01 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -475,6 +475,7 @@ expand(const char *name)
 
 	switch (e) {
 	case 0: /* OK */
+		break;
 	case WRDE_NOSPACE:
 		warnx("Out of memory expanding `%s'", name);
 		return NULL;
@@ -497,9 +498,9 @@ expand(const char *name)
 		warnx("No match for `%s'", name);
 		break;
 	case 1:
-		if (strlen(we.we_wordv[1]) >= PATHSIZE)
+		if (strlen(we.we_wordv[0]) >= PATHSIZE)
 			warnx("Expansion too long for `%s'", name);
-		strlcpy(xname, we.we_wordv[1], PATHSIZE);
+		strlcpy(xname, we.we_wordv[0], PATHSIZE);
 		break;
 	default:
 		warnx("Ambiguous expansion for `%s'", name);

Index: src/usr.bin/mail/names.c
diff -u src/usr.bin/mail/names.c:1.31 src/usr.bin/mail/names.c:1.32
--- src/usr.bin/mail/names.c:1.31	Tue Dec 16 14:30:24 2014
+++ src/usr.bin/mail/names.c	Sat Jan 10 12:16:01 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: names.c,v 1.31 2014/12/16 19:30:24 christos Exp $	*/
+/*	$NetBSD: names.c,v 1.32 2015/01/10 17:16:01 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.31 2014/12/16 19:30:24 christos Exp $");
+__RCSID("$NetBSD: names.c,v 1.32 2015/01/10 17:16:01 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -550,7 +550,7 @@ unpack(struct name *smopts, struct name 
 	 * the terminating 0 pointer.  Additional spots may be needed
 	 * to pass along -f to the host mailer.
 	 */
-	extra = 3 * count(smopts);
+	extra = 3 + count(smopts);
 	extra++;
 	metoo = value(ENAME_METOO) != NULL;
 	if (metoo)

Reply via email to