mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Merge pull request #4401 from embhorn/gh4400
Fix overflow check in ClientMemSend
This commit is contained in:
@@ -595,9 +595,9 @@ static int ClientMemSend(info_t* info, char* buf, int sz)
|
|||||||
|
|
||||||
#ifndef BENCH_USE_NONBLOCK
|
#ifndef BENCH_USE_NONBLOCK
|
||||||
/* check for overflow */
|
/* check for overflow */
|
||||||
if (info->to_client.write_idx + sz > MEM_BUFFER_SZ) {
|
if (info->to_server.write_idx + sz > MEM_BUFFER_SZ) {
|
||||||
printf("ClientMemSend overflow %d %d %d\n",
|
printf("ClientMemSend overflow %d %d %d\n",
|
||||||
info->to_client.write_idx, sz, MEM_BUFFER_SZ);
|
info->to_server.write_idx, sz, MEM_BUFFER_SZ);
|
||||||
osSemaphoreRelease(info->server.mutex);
|
osSemaphoreRelease(info->server.mutex);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -412,8 +412,8 @@ static int ClientMemSend(info_t* info, char* buf, int sz)
|
|||||||
|
|
||||||
#ifndef BENCH_USE_NONBLOCK
|
#ifndef BENCH_USE_NONBLOCK
|
||||||
/* check for overflow */
|
/* check for overflow */
|
||||||
if (info->to_client.write_idx + sz > MEM_BUFFER_SZ) {
|
if (info->to_server.write_idx + sz > MEM_BUFFER_SZ) {
|
||||||
fprintf(stderr, "ClientMemSend overflow %d %d %d\n", info->to_client.write_idx, sz, MEM_BUFFER_SZ);
|
fprintf(stderr, "ClientMemSend overflow %d %d %d\n", info->to_server.write_idx, sz, MEM_BUFFER_SZ);
|
||||||
pthread_mutex_unlock(&info->to_server.mutex);
|
pthread_mutex_unlock(&info->to_server.mutex);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user