diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-06-02 21:09:06 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-06-02 21:09:06 +0300 |
commit | 8a857a7f7519414c2294cc9f3286ebe5dba5a6f3 (patch) | |
tree | b2cfe050f5465bd53c0b66e3880cfcb3e025b387 /pb_decode.c | |
parent | 8611958a7f5ec16261cbacaf62a0ea92fd9dd314 (diff) |
Don't use SIZE_MAX macro, as it is not in C89.
Update issue 120
Status: FixedInGit
Diffstat (limited to 'pb_decode.c')
-rw-r--r-- | pb_decode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pb_decode.c b/pb_decode.c index d687cee3..8b782a6f 100644 --- a/pb_decode.c +++ b/pb_decode.c @@ -487,7 +487,8 @@ static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t const size_t check_limit = (size_t)1 << (sizeof(size_t) * 4); if (data_size >= check_limit || array_size >= check_limit) { - if (SIZE_MAX / array_size < data_size) + const size_t size_max = (size_t)-1; + if (size_max / array_size < data_size) { PB_RETURN_ERROR(stream, "size too large"); } |