Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix applying non-zero offset 1 to null pointer ASAN error #7644

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -26546,6 +26546,14 @@ int GetCipherSuiteFromName(const char* name, byte* cipherSuite0,
return ret;
}

static inline int IncrementUnlessNull(const char** ptr) {
if (*ptr == NULL) {
return 0;
}
*ptr += 1;
return 1;
}

/**
Set the enabled cipher suites.

Expand Down Expand Up @@ -26940,7 +26948,7 @@ static int ParseCipherList(Suites* suites,
}
alexsn marked this conversation as resolved.
Show resolved Hide resolved
}
}
while (next++); /* ++ needed to skip ':' */
while (IncrementUnlessNull(&next)); /* increment needed to skip ':' */

if (ret) {
int keySz = 0;
Expand Down
10 changes: 9 additions & 1 deletion src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -8356,6 +8356,14 @@ int tlsShowSecrets(WOLFSSL* ssl, void* secret, int secretSz,

#ifdef OPENSSL_EXTRA

static inline int IncrementUnlessNull(char** ptr) {
if (*ptr == NULL) {
return 0;
}
*ptr += 1;
return 1;
}

/*
* check if the list has TLS13 and pre-TLS13 suites
* @param list cipher suite list that user want to set
Expand Down Expand Up @@ -8433,7 +8441,7 @@ static int CheckcipherList(const char* list)
return 0;
}
}
while (next++); /* ++ needed to skip ':' */
while (IncrementUnlessNull(&next)); /* increment needed to skip ':' */

if (findTLSv13Suites == 0 && findbeforeSuites == 1) {
ret = 1;/* only before TLSv13 suites */
Expand Down