summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2017-01-29 10:04:14 +0000
committerMarc Espie <espie@cvs.openbsd.org>2017-01-29 10:04:14 +0000
commitcc8885deebcd7bd625ecc8778ba696ab1bfc47f1 (patch)
treec0afab95d93f1ae6386462f763e64d6408f4713f /usr.bin
parent54fb9612f99081a374fda63d0cc948d358743c45 (diff)
obvious protection against null pointer, because it's quite possible for cgn
to not have a parent...
Diffstat (limited to 'usr.bin')
-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. */