Skip to content

Commit

Permalink
check for negative size
Browse files Browse the repository at this point in the history
resolves -Wstringop-overflow
  • Loading branch information
nosracd committed Dec 23, 2024
1 parent 2a7dd51 commit 6f29d22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lcm/lcm_coretypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static inline int __int8_t_encode_array(void *_buf, int offset, int maxlen, cons
static inline int __int8_t_decode_array(const void *_buf, int offset, int maxlen, int8_t *p,
int elements)
{
if (maxlen < elements)
if (maxlen < elements || elements < 0)
return -1;

const int8_t *buf = (const int8_t *) _buf;
Expand Down

0 comments on commit 6f29d22

Please sign in to comment.