Skip to content

Commit eef529e

Browse files
committed
Move stack->next assignment within if (stack) check
The code checks if stack is a NULL pointer. Below that if the stack->next pointer is updated unconditionally. Therefore a call with a NULL pointer will crash, even though the if (stack) check shows the intent that it is valid to call the function with NULL. The assignment to stack->next was not in the initial version of the code. Fix it by moving the assignment inside the if's body.
1 parent adc2382 commit eef529e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sapi/phpdbg/phpdbg_cmd.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,9 @@ PHPDBG_API void phpdbg_stack_free(phpdbg_param_t *stack) {
422422
remove = next;
423423
else break;
424424
}
425-
}
426-
427425

428-
stack->next = NULL;
426+
stack->next = NULL;
427+
}
429428
} /* }}} */
430429

431430
/* {{{ */

0 commit comments

Comments
 (0)