Commit e43ed4f0 authored by Ilya Lipnitskiy's avatar Ilya Lipnitskiy

protobuf-c.c: Cast %lu args to unsigned long int

Resolves an ambiguity that %zu was meant to address, since %zu is not
present on all platforms.

Fixes #357.
parent 39cd58f5
...@@ -2132,11 +2132,13 @@ scan_length_prefixed_data(size_t len, const uint8_t *data, ...@@ -2132,11 +2132,13 @@ scan_length_prefixed_data(size_t len, const uint8_t *data,
// Protobuf messages should always be less than 2 GiB in size. // Protobuf messages should always be less than 2 GiB in size.
// We also want to return early here so that hdr_len + val does // We also want to return early here so that hdr_len + val does
// not overflow on 32-bit systems. // not overflow on 32-bit systems.
PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large", val); PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large",
(unsigned long int)val);
return 0; return 0;
} }
if (hdr_len + val > len) { if (hdr_len + val > len) {
PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu", val); PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu",
(unsigned long int)val);
return 0; return 0;
} }
return hdr_len + val; return hdr_len + val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment