diff --git a/lib/nrng/src/nrng_json.c b/lib/nrng/src/nrng_json.c index 940c130..ed0c87e 100644 --- a/lib/nrng/src/nrng_json.c +++ b/lib/nrng/src/nrng_json.c @@ -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'){