Fixes for the server examples using incorect length for memcpy operation in reply and reading past const char string. Resolves Jenkins "wolfSSL Examples Repo Test - NIGHTLY BUILD" reports.

pull/136/head
David Garske 2019-03-13 09:16:43 -07:00
parent 3b49bd339c
commit d330c53baf
10 changed files with 19 additions and 10 deletions

View File

@ -54,6 +54,7 @@ int server_connect(sgx_enclave_id_t id)
char buff[256];
size_t len;
int ret = 0; /* variable for error checking */
const char* reply = "I hear ya fa shizzle!\n";
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx;
@ -168,7 +169,7 @@ int server_connect(sgx_enclave_id_t id)
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */

View File

@ -53,6 +53,7 @@ int server_tls(int devId, Pkcs11Token* token)
int shutdown = 0;
int ret;
unsigned char privKeyId[] = PRIV_KEY_ID;
const char* reply = "I hear ya fa shizzle!\n";
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx;
@ -187,7 +188,7 @@ int server_tls(int devId, Pkcs11Token* token)
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */

View File

@ -53,6 +53,7 @@ int server_tls(int devId, Pkcs11Token* token)
int shutdown = 0;
int ret;
unsigned char privKeyId[] = PRIV_KEY_ID;
const char* reply = "I hear ya fa shizzle!\n";
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx;
@ -187,7 +188,7 @@ int server_tls(int devId, Pkcs11Token* token)
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */

View File

@ -374,7 +374,7 @@ buffer like this:
```c
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
```

View File

@ -44,6 +44,7 @@ int main()
char buff[256];
size_t len;
int shutdown = 0;
const char* reply = "I hear ya fa shizzle!\n";
@ -116,7 +117,7 @@ int main()
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */

View File

@ -152,6 +152,7 @@ int main()
size_t len;
int shutdown = 0;
int ret;
const char* reply = "I hear ya fa shizzle!\n";
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx;
@ -281,7 +282,7 @@ int main()
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */

View File

@ -54,6 +54,7 @@ int main()
size_t len;
int shutdown = 0;
int ret;
const char* reply = "I hear ya fa shizzle!\n";
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx;
@ -180,7 +181,7 @@ int main()
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */

View File

@ -53,6 +53,7 @@ int main()
size_t len;
int shutdown = 0;
int ret;
const char* reply = "I hear ya fa shizzle!\n";
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx;
@ -188,7 +189,7 @@ int main()
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */

View File

@ -65,6 +65,7 @@ void* ClientHandler(void* args)
char buff[256];
size_t len;
int ret;
const char* reply = "I hear ya fa shizzle!\n";
/* Create a WOLFSSL object */
@ -110,7 +111,7 @@ void* ClientHandler(void* args)
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */

View File

@ -52,6 +52,7 @@ int main()
size_t len;
int shutdown = 0;
int ret;
const char* reply = "I hear ya fa shizzle!\n";
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx;
@ -175,7 +176,7 @@ int main()
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, "I hear ya fa shizzle!\n", sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */