Clang analyzer incorrectly reports that an uninitialized buffer is
passed to json_parser_feed(). The buffer is initialized by fread()
before use, but declaring it inside the loop scope confuses the
analyzer's control flow analysis on subsequent loop iterations.
Found with clang analyze.
Fixes: f38b84ea2b6b ("Implement JSON parsing and serialization.")
Signed-off-by: Mike Pattrick <[email protected]>
---
lib/json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/json.c b/lib/json.c
index 23000f195..b5b1330d1 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -1258,11 +1258,11 @@ struct json *
json_from_stream(FILE *stream)
{
struct json_parser *p;
+ char buffer[BUFSIZ];
struct json *json;
p = json_parser_create(JSPF_TRAILER);
for (;;) {
- char buffer[BUFSIZ];
size_t n;
n = fread(buffer, 1, sizeof buffer, stream);
--
2.53.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev