Skip to content

Commit

Permalink
fixup! Fix issues reported by Coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielius1922 committed Sep 26, 2024
1 parent 1602616 commit 9feb9ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion api/oc_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
10 changes: 8 additions & 2 deletions util/jsmn/jsmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 9feb9ae

Please sign in to comment.