summaryrefslogtreecommitdiff
path: root/librabbitmq/amqp_consumer.c
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2015-03-18 22:39:23 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2015-05-04 23:40:34 -0700
commitcab5da170ab4e4eba621ae9f14711a4f09e9760b (patch)
treed7f0f4d53755a677b107c6f98ae4841193449fd5 /librabbitmq/amqp_consumer.c
parentf462c0f4a6f471038ceb2097fb0bf4c4776957ac (diff)
downloadrabbitmq-c-cab5da170ab4e4eba621ae9f14711a4f09e9760b.tar.gz
Fix int truncation warnings on Win32
Diffstat (limited to 'librabbitmq/amqp_consumer.c')
-rw-r--r--librabbitmq/amqp_consumer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/librabbitmq/amqp_consumer.c b/librabbitmq/amqp_consumer.c
index cf08fd5..dca22f6 100644
--- a/librabbitmq/amqp_consumer.c
+++ b/librabbitmq/amqp_consumer.c
@@ -252,7 +252,12 @@ amqp_rpc_reply_t amqp_read_message(amqp_connection_state_t state,
if (0 == frame.payload.properties.body_size) {
message->body = amqp_empty_bytes;
} else {
- message->body = amqp_bytes_malloc(frame.payload.properties.body_size);
+ if (SIZE_MAX < frame.payload.properties.body_size) {
+ ret.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
+ ret.library_error = AMQP_STATUS_NO_MEMORY;
+ goto error_out1;
+ }
+ message->body = amqp_bytes_malloc((size_t)frame.payload.properties.body_size);
if (NULL == message->body.bytes) {
ret.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
ret.library_error = AMQP_STATUS_NO_MEMORY;