summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2017-01-29 10:04:13 +0000
committerespie <espie@openbsd.org>2017-01-29 10:04:13 +0000
commit68097c0d03d06fe2ab877d39ea1f28af36abf6a0 (patch)
treef6714be7a2f1a832cd19fb581c41b8d42770d6a8
parentouch, smallest regress ever. Can't believe no-one got bitten by this (diff)
downloadwireguard-openbsd-68097c0d03d06fe2ab877d39ea1f28af36abf6a0.tar.xz
wireguard-openbsd-68097c0d03d06fe2ab877d39ea1f28af36abf6a0.zip
obvious protection against null pointer, because it's quite possible for cgn
to not have a parent...
-rw-r--r--usr.bin/make/engine.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c
index 688d26ecb32..f6684cfa4ef 100644
--- a/usr.bin/make/engine.c
+++ b/usr.bin/make/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.51 2016/10/21 16:12:38 espie Exp $ */
+/* $OpenBSD: engine.c,v 1.52 2017/01/29 10:04:13 espie Exp $ */
/*
* Copyright (c) 2012 Marc Espie.
*
@@ -300,6 +300,10 @@ Make_HandleUse(GNode *cgn, /* The .USE node */
assert(cgn->type & (OP_USE|OP_TRANSFORM));
+ if (pgn == NULL)
+ Fatal("Trying to apply .USE to '%s' without a parent",
+ cgn->name);
+
if ((cgn->type & OP_USE) || Lst_IsEmpty(&pgn->commands)) {
/* .USE or transformation and target has no commands
* -- append the child's commands to the parent. */