From: Randall S. Becker Date: Thu, 1 Jun 2023 19:29:15 +0000 (-0600) Subject: Modified OSSL_parse_url to initialize pport_num to 0. X-Git-Tag: openssl-3.1.2~33 X-Git-Url: https://git.openssl.org/gitweb/?a=commitdiff_plain;h=45cd2554efc82f8959b4e8ac53bc419b4d5e195a;p=openssl.git Modified OSSL_parse_url to initialize pport_num to 0. This change is intended to provide some safety for uninitialized stack failures that have appeared in 80-test_cmp_http on NonStop x86 when run in a complex CI/CD Jenkins environment. This change also adds init_pint() to handle the initialization of a pointer to int value. Fixes: #21083 Signed-off-by: Randall S. Becker Reviewed-by: Paul Dale Reviewed-by: Richard Levitte Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/21109) --- diff --git a/crypto/http/http_lib.c b/crypto/http/http_lib.c index 911f159081..3164d01d9e 100644 --- a/crypto/http/http_lib.c +++ b/crypto/http/http_lib.c @@ -22,6 +22,13 @@ static void init_pstring(char **pstr) } } +static void init_pint(int *pint) +{ + if (pint != NULL) { + *pint = 0; + } +} + static int copy_substring(char **dest, const char *start, const char *end) { return dest == NULL @@ -54,6 +61,7 @@ int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost, init_pstring(puser); init_pstring(phost); init_pstring(pport); + init_pint(pport_num); init_pstring(ppath); init_pstring(pfrag); init_pstring(pquery);