Skip to content

Commit ec0a2f2

Browse files
author
Andras Fekete
committed
Fix 'negative character value'
In a number of libc implementations, isalpha()/isalnum() is implemented using lookup tables (arrays): passing in a negative value can result in a read underrun.
1 parent 1abaa94 commit ec0a2f2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/conf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ static char* expandValue(WOLFSSL_CONF *conf, const char* section,
744744
strIdx += 2;
745745
startIdx = strIdx;
746746
}
747-
while (*strIdx && (XISALNUM((int)(*strIdx)) || *strIdx == '_'))
747+
while (*strIdx && (XISALNUM(*strIdx) || *strIdx == '_'))
748748
strIdx++;
749749
endIdx = strIdx;
750750
if (startIdx == endIdx) {

wolfssl/test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ static WC_INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer,
12251225

12261226
#ifndef TEST_IPV6
12271227
/* peer could be in human readable form */
1228-
if ( ((size_t)peer != INADDR_ANY) && isalpha((int)peer[0])) {
1228+
if ( ((size_t)peer != INADDR_ANY) && isalpha(peer[0])) {
12291229
#ifdef WOLFSSL_USE_POPEN_HOST
12301230
char host_ipaddr[4] = { 127, 0, 0, 1 };
12311231
int found = 1;

0 commit comments

Comments
 (0)