diff --git a/src/wolfio.c b/src/wolfio.c index 3462e2b3e..cc31928b0 100644 --- a/src/wolfio.c +++ b/src/wolfio.c @@ -39,7 +39,7 @@ #include #if defined(HAVE_HTTP_CLIENT) - #include /* atoi(), strtol() */ + #include /* strtol() */ #endif /* @@ -1101,7 +1101,7 @@ int wolfIO_HttpProcessResponse(int sfd, const char** appStrList, else if (XSTRNCASECMP(start, "Content-Length:", 15) == 0) { start += 15; while (*start == ' ' && *start != '\0') start++; - chunkSz = atoi(start); + chunkSz = XATOI(start); state = (state == phr_http_start) ? phr_have_length : phr_wait_end; } else if (XSTRNCASECMP(start, "Transfer-Encoding:", 18) == 0) { diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 1797231e2..9857f83b9 100755 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -5753,7 +5753,7 @@ int main(int argc, char** argv) while (argc > 1) { if (string_matches(argv[1], "-?")) { if(--argc>1){ - lng_index = atoi((++argv)[1]); + lng_index = XATOI((++argv)[1]); if(lng_index<0||lng_index>1) { lng_index = 0; } @@ -5772,7 +5772,7 @@ int main(int argc, char** argv) argc--; argv++; if(argc>1) { - lng_index = atoi(argv[1]); + lng_index = XATOI(argv[1]); if(lng_index<0||lng_index>1){ printf("invalid number(%d) is specified. [ :0-1]\n",lng_index); lng_index = 0; @@ -5802,7 +5802,7 @@ int main(int argc, char** argv) argc--; argv++; if (argc > 1) { - g_threadCount = atoi(argv[1]); + g_threadCount = XATOI(argv[1]); if (g_threadCount < 1 || lng_index > 128){ printf("invalid number(%d) is specified. [ :1-128]\n", g_threadCount); @@ -5867,7 +5867,7 @@ int main(int argc, char** argv) } else { /* parse for block size */ - benchmark_configure(atoi(argv[1])); + benchmark_configure(XATOI(argv[1])); } argc--; argv++; diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index e621c072d..9e68151cb 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -10973,7 +10973,7 @@ int EncodePolicyOID(byte *out, word32 *outSz, const char *in, void* heap) token = XSTRTOK(str, ".", &ptr); while (token != NULL) { - val = (word32)atoi(token); + val = (word32)XATOI(token); if (nb_val == 0) { if (val > 2) { diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index cc54ada78..0dabd946e 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -401,6 +401,9 @@ #define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n)) #define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n)) + #include + #define XATOI(s) atoi((s)) + #ifdef USE_WOLF_STRSEP #define XSTRSEP(s1,d) wc_strsep((s1),(d)) #else