Fix variable-length string print to prevent overflow (fixes
@@ -28,7 +28,7 @@ bool key_found = false;
void find_string(void * _ctx, cbor_data buffer, size_t len)
{
if (key_found) {
- printf("Found the value: %*s\n", (int) len, buffer);
+ printf("Found the value: %.*s\n", (int) len, buffer);
key_found = false;
} else if (len == strlen(key)) {
key_found = (memcmp(key, buffer, len) == 0);
