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.
parent
3b49bd339c
commit
d330c53baf
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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));
|
||||
```
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue