summaryrefslogtreecommitdiff
path: root/usr.bin/mail/lex.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-06-30 16:00:30 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-06-30 16:00:30 +0000
commitb643bb9badf4a995d989b8daf3e33ba8ee6ffda2 (patch)
tree87720e8aa60a5b4230d0072dfd2b3d422d7dd1cd /usr.bin/mail/lex.c
parent46239127052c30fac93140fbe021cdd151fdac8a (diff)
warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant). These are not security holes but it is worth fixing them anyway both for robustness and so folks looking for examples in the tree are not misled into doing something potentially dangerous. Furthermore, it is a bad idea to assume that pathnames will not include '%' in them and that error routines don't return strings with '%' in them (especially in light of the possibility of locales).
Diffstat (limited to 'usr.bin/mail/lex.c')
-rw-r--r--usr.bin/mail/lex.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c
index b1405843e5f..5b6099013f3 100644
--- a/usr.bin/mail/lex.c
+++ b/usr.bin/mail/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.19 2000/04/25 16:42:22 millert Exp $ */
+/* $OpenBSD: lex.c,v 1.20 2000/06/30 16:00:19 millert Exp $ */
/* $NetBSD: lex.c,v 1.10 1997/05/17 19:55:13 pk Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95";
#else
-static char rcsid[] = "$OpenBSD: lex.c,v 1.19 2000/04/25 16:42:22 millert Exp $";
+static char rcsid[] = "$OpenBSD: lex.c,v 1.20 2000/06/30 16:00:19 millert Exp $";
#endif
#endif /* not lint */
@@ -79,7 +79,7 @@ setfile(name)
if ((ibuf = Fopen(name, "r")) == NULL) {
if (!isedit && errno == ENOENT)
goto nomail;
- warn(name);
+ warn("%s", name);
return(-1);
}
@@ -93,7 +93,7 @@ setfile(name)
case S_IFDIR:
(void)Fclose(ibuf);
errno = EISDIR;
- warn(name);
+ warn("%s", name);
return(-1);
case S_IFREG:
@@ -102,7 +102,7 @@ setfile(name)
default:
(void)Fclose(ibuf);
errno = EINVAL;
- warn(name);
+ warn("%s", name);
return(-1);
}
@@ -143,10 +143,10 @@ setfile(name)
"%s/mail.RxXXXXXXXXXX", tmpdir);
if ((fd = mkstemp(tempname)) == -1 ||
(otf = fdopen(fd, "w")) == NULL)
- err(1, tempname);
+ err(1, "%s", tempname);
(void)fcntl(fileno(otf), F_SETFD, 1);
if ((itf = fopen(tempname, "r")) == NULL)
- err(1, tempname);
+ err(1, "%s", tempname);
(void)fcntl(fileno(itf), F_SETFD, 1);
(void)rm(tempname);
setptr(ibuf, 0);