Skip to content

Commit

Permalink
Modified OSSL_parse_url to initialize pport_num to 0.
Browse files Browse the repository at this point in the history
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 <randall.becker@nexbridge.ca>

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #21109)

(cherry picked from commit 45cd255)
  • Loading branch information
rsbeckerca authored and t8m committed Jul 14, 2023
1 parent b6bf1cb commit ba189e0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crypto/http/http_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ba189e0

Please sign in to comment.