diff --git a/api/oc_endpoint.c b/api/oc_endpoint.c index 16ba8ca4a..785ad5738 100644 --- a/api/oc_endpoint.c +++ b/api/oc_endpoint.c @@ -171,7 +171,10 @@ oc_endpoint_to_cstring(const oc_endpoint_t *endpoint, char *buffer, return -1; } // overflow check for coverity scan - assert(len <= INT_MAX - written && "Integer overflow detected"); + // assert(len <= INT_MAX - written && "Integer overflow detected"); + if (len > INT_MAX - written) { + return -1; + } return len + written; } diff --git a/util/jsmn/jsmn.c b/util/jsmn/jsmn.c index 83e5c89cd..5b3fd8e63 100644 --- a/util/jsmn/jsmn.c +++ b/util/jsmn/jsmn.c @@ -249,7 +249,10 @@ jsmn_parse_next_char(jsmn_parser_t *parser, jsmntok_t *token, const char *js, return r; } // overflow check for coverity scan - assert(count <= INT_MAX - r && "Integer overflow detected"); + // assert(count <= INT_MAX - r && "Integer overflow detected"); + if (count > INT_MAX - r) { + return -1 + } count += r; break; } @@ -299,7 +302,10 @@ jsmn_parse(jsmn_parser_t *parser, const char *js, const size_t len, return r; } // overflow check for coverity scan - assert(count <= INT_MAX - r && "Integer overflow detected"); + // assert(count <= INT_MAX - r && "Integer overflow detected"); + if (count > INT_MAX - r) { + return -1 + } count += r; }