mirror of https://gerrit.osmocom.org/asn1c
introduce RSSIZE_MAX to set maximum of ssize_t
This commit is contained in:
parent
1a364656a6
commit
9368263165
|
@ -145,5 +145,8 @@ typedef unsigned int uint32_t;
|
|||
#ifndef RSIZE_MAX /* C11, Annex K */
|
||||
#define RSIZE_MAX (SIZE_MAX >> 1)
|
||||
#endif
|
||||
#ifndef RSSIZE_MAX /* Halve signed size even further than unsigned */
|
||||
#define RSSIZE_MAX ((ssize_t)(RSIZE_MAX >> 1))
|
||||
#endif
|
||||
|
||||
#endif /* ASN_SYSTEM_H */
|
||||
|
|
|
@ -50,7 +50,7 @@ ber_fetch_length(int _is_constructed, const void *bufptr, size_t size,
|
|||
}
|
||||
|
||||
if(oct == 0) {
|
||||
if(len < 0 || len > RSIZE_MAX) {
|
||||
if(len < 0 || len > RSSIZE_MAX) {
|
||||
/* Length value out of sane range. */
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue