summaryrefslogtreecommitdiff
path: root/usr.bin/patch
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>2004-12-09 18:06:10 +0000
committermycroft <mycroft@NetBSD.org>2004-12-09 18:06:10 +0000
commit33131ab95f8124892350e03f3972b94e382426dc (patch)
treecb9b3d71b2c37ee16f8c368ce8a7c7f04375d927 /usr.bin/patch
parent548afc964d8037f7b68fde1a083bd35daf77b21c (diff)
Fix an array overrun in option parsing.
Fixes PR 26732, PR 26775, PR 28416 and PR 28589.
Diffstat (limited to 'usr.bin/patch')
-rw-r--r--usr.bin/patch/patch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index f52c8697d23..7a2e041a9d5 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -1,4 +1,4 @@
-/* $NetBSD: patch.c,v 1.21 2004/08/14 12:53:35 cube Exp $ */
+/* $NetBSD: patch.c,v 1.22 2004/12/09 18:06:10 mycroft Exp $ */
/* patch - a program to apply diffs to original files
*
@@ -25,7 +25,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: patch.c,v 1.21 2004/08/14 12:53:35 cube Exp $");
+__RCSID("$NetBSD: patch.c,v 1.22 2004/12/09 18:06:10 mycroft Exp $");
#endif /* not lint */
#include "INTERN.h"
@@ -578,7 +578,7 @@ Options:\n\
[-r rej-name] [-V {numbered,existing,simple}]\n");
my_exit(1);
}
- opt = *++s;
+ opt = *s ? *++s : '\0';
} while (opt != '\0');
}
}