Skip to content

Commit

Permalink
lib/nrng: don't overflow json->iobuf
Browse files Browse the repository at this point in the history
This fixes the issue:
  Decawave/uwb-apps#8
  • Loading branch information
rouming committed Jun 9, 2022
1 parent 5fcc5e6 commit 9265373
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/nrng/src/nrng_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ static int
nrng_write_line(void *buf, char* data, int len)
{
nrng_json_t * json = buf;

len = min(len, sizeof(json->iobuf) - json->idx);
for (uint16_t i=0; i < len; i++){
json->iobuf[json->idx++] = data[i];
if (data[i]=='\0'){
Expand Down

0 comments on commit 9265373

Please sign in to comment.