We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 135f087 commit 5105db3Copy full SHA for 5105db3
tmk_core/protocol/nrf/bmp.c
@@ -456,8 +456,9 @@ int stream_write_callback(const uint8_t* dat, uint32_t len)
456
dst = parser.setting->string_dst;
457
dst_len = parser.setting->dst_len;
458
459
- if (parser.write_idx + len > dst_len)
+ if (parser.write_idx + len + 1 > dst_len)
460
{
461
+ // buffer overflow
462
parser.write_idx = 0;
463
set_parser(PARSER_NONE);
464
@@ -472,6 +473,7 @@ int stream_write_callback(const uint8_t* dat, uint32_t len)
472
473
json_close = is_json_closed((const char*)dst, parser.write_idx);
474
if (json_close == 0)
475
476
+ dst[parser.write_idx] = '\0';
477
int res = parser.setting->parse();
478
479
BMPAPI->logger.info("Received json");
0 commit comments