lloyd / yajl

A fast streaming JSON parsing library in C.
http://lloyd.github.com/yajl
ISC License
2.15k stars 435 forks source link

parse_config example end of buffer should be set to 0 #185

Open cirvladimir opened 8 years ago

cirvladimir commented 8 years ago

In parse_config.c you have the following code:

fileData[0] = errbuf[0] = 0;

Perhaps I misunderstand the purpose of it but I think instead you should have

fileData[rd] = 0;

on the line before you do yajl_tree_parse.

My rationale is because not having fileData[rd] = 0; potentially breaks the example, and as long as you read anything into fileData these lines have no point.

Please correct me if I'm misunderstanding something.