summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch/inp.c
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2014-11-25 10:22:08 +0000
committertobias <tobias@openbsd.org>2014-11-25 10:22:08 +0000
commitf1fb109e863a89b1567e97242cd61671f935814f (patch)
treeeab8e37ed9f7b79b789c11bce5bd19bd447557df /usr.bin/patch/inp.c
parentRelease file descriptors as soon as they are not needed anymore. (diff)
downloadwireguard-openbsd-f1fb109e863a89b1567e97242cd61671f935814f.tar.xz
wireguard-openbsd-f1fb109e863a89b1567e97242cd61671f935814f.zip
Prevent null pointer dereference on empty input files when diff requires
a specific version. ok millert
Diffstat (limited to 'usr.bin/patch/inp.c')
-rw-r--r--usr.bin/patch/inp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c
index eddf723474d..760a9b307df 100644
--- a/usr.bin/patch/inp.c
+++ b/usr.bin/patch/inp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inp.c,v 1.40 2014/11/22 15:49:28 tobias Exp $ */
+/* $OpenBSD: inp.c,v 1.41 2014/11/25 10:22:08 tobias Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -303,7 +303,7 @@ plan_a(const char *filename)
/* now check for revision, if any */
if (revision != NULL) {
- if (!rev_in_string(i_womp)) {
+ if (i_womp == NULL || !rev_in_string(i_womp)) {
if (force) {
if (verbose)
say("Warning: this file doesn't appear "