Fix overflow check in ClientMemSend

This commit is contained in:
Eric Blankenhorn
2021-09-14 10:29:58 -05:00
parent ab3bbf11e9
commit 2274d0b773
2 changed files with 4 additions and 4 deletions

View File

@ -595,9 +595,9 @@ static int ClientMemSend(info_t* info, char* buf, int sz)
#ifndef BENCH_USE_NONBLOCK
/* 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",
info->to_client.write_idx, sz, MEM_BUFFER_SZ);
info->to_server.write_idx, sz, MEM_BUFFER_SZ);
osSemaphoreRelease(info->server.mutex);
return -1;
}

View File

@ -412,8 +412,8 @@ static int ClientMemSend(info_t* info, char* buf, int sz)
#ifndef BENCH_USE_NONBLOCK
/* check for overflow */
if (info->to_client.write_idx + sz > MEM_BUFFER_SZ) {
fprintf(stderr, "ClientMemSend overflow %d %d %d\n", 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_server.write_idx, sz, MEM_BUFFER_SZ);
pthread_mutex_unlock(&info->to_server.mutex);
return -1;
}