summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2019-01-14 00:59:20 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2019-01-14 00:59:20 +0000
commitb0c14eff41186cd1d0a015c2cac716618cb53e57 (patch)
treece78b4452ce6a136962bc361be5b607cc3783066 /bin
parent0b02799653a61e952946e14ae55617141e8fa8c0 (diff)
do not peek before the beginning of a string
ok deraadt schwarze tb
Diffstat (limited to 'bin')
-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;