summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2019-01-14 00:59:19 +0000
committertedu <tedu@openbsd.org>2019-01-14 00:59:19 +0000
commit0dd2a5d5b0b2eefed9732e1db44e78a857efc6ff (patch)
treed6e9416846ec3b0b1a1e2e227c359f5aa96bfdaa
parentSkip open of "network" ttys because they permanently retain the (large) (diff)
downloadwireguard-openbsd-0dd2a5d5b0b2eefed9732e1db44e78a857efc6ff.tar.xz
wireguard-openbsd-0dd2a5d5b0b2eefed9732e1db44e78a857efc6ff.zip
do not peek before the beginning of a string
ok deraadt schwarze tb
-rw-r--r--bin/ksh/mail.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ksh/mail.c b/bin/ksh/mail.c
index 570722d57bc..e97bff6b33e 100644
--- a/bin/ksh/mail.c
+++ b/bin/ksh/mail.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mail.c,v 1.25 2019/01/07 20:50:43 tedu Exp $ */
+/* $OpenBSD: mail.c,v 1.26 2019/01/14 00:59:19 tedu Exp $ */
/*
* Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -128,7 +128,7 @@ mpset(char *mptoparse)
/* POSIX/bourne-shell say file%message */
for (p = mpath; (mmsg = strchr(p, '%')); ) {
/* a literal percent? (POSIXism) */
- if (mmsg[-1] == '\\') {
+ if (mmsg > mpath && mmsg[-1] == '\\') {
/* use memmove() to avoid overlap problems */
memmove(mmsg - 1, mmsg, strlen(mmsg) + 1);
p = mmsg + 1;