From 728639e8170ca72f6c2e2dbe79e7090a6d7b3dc1 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 25 May 2020 17:30:41 -0400 Subject: [PATCH] lib/base: heim_config_parse_debug initialize output parameters The caller of heim_config_parse_debug() expects the output parameters to be initialized even when the return code is non-zero. This change initializes the output parameters in case the caller did not. Not all code paths assign values to the output parameters which can result in unexpected termination of the process when an uninitialized stack pointer is assumed to be valid. Change-Id: Ib7530a9f16ba3e1500a7e27ccdd8ad9f0492b464 --- lib/base/config_file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/base/config_file.c b/lib/base/config_file.c index b759c717f..44b88f3b8 100644 --- a/lib/base/config_file.c +++ b/lib/base/config_file.c @@ -392,6 +392,9 @@ heim_config_parse_debug(struct fileptr *f, char buf[2048]; heim_error_code ret; + *lineno = 0; + *err_message = ""; + while (config_fgets(buf, sizeof(buf), f) != NULL) { char *p;