]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* expand.c (variable_append): [SV 49113] Possible null ptr deref
authorJaak Ristioja <jaak@ristioja.ee>
Sun, 18 Dec 2016 14:48:46 +0000 (09:48 -0500)
committerPaul Smith <psmith@gnu.org>
Sun, 25 Dec 2016 23:18:45 +0000 (18:18 -0500)
expand.c

index 0b5fd0117dffe2780874bb9dcc4592705dba31d8..60c60718f13efaf3ce79cf2546b47c4686d17141 100644 (file)
--- a/expand.c
+++ b/expand.c
@@ -490,13 +490,15 @@ variable_append (const char *name, unsigned int length,
 {
   const struct variable *v;
   char *buf = 0;
-  /* If this set is local and the next is not a parent, then next is local.  */
-  int nextlocal = local && set->next_is_parent == 0;
+  int nextlocal;
 
   /* If there's nothing left to check, return the empty buffer.  */
   if (!set)
     return initialize_variable_output ();
 
+  /* If this set is local and the next is not a parent, then next is local.  */
+  nextlocal = local && set->next_is_parent == 0;
+
   /* Try to find the variable in this variable set.  */
   v = lookup_variable_in_set (name, length, set->set);