Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json: do not rely on json_object_is_type() accepting NULL #578

Merged
merged 1 commit into from
Jul 23, 2015

Conversation

vincentbernat
Copy link
Contributor

Starting from jsonc 0.10, json_object_is_type() started handling NULL
appropriately. With previous versions, calling this function with NULL
would lead to a segfault.

The version embedded in syslog-ng is recent enough. This fix is for
people using --with-jsonc=system and having a too old system jsonc
library (like the one in Ubuntu Precise).

I have experienced the "bug" in json/json-parser.c. I think that the "bug" could also be triggered in dot-notation.c but I can't be sure. The test may be unneeded.

Not using embedded libs is a common culture in distributions and is useful to get security updates (jsonc had several CVE fixes in the past). So, I think the use case is valid, but I can understand if it would be dismissed.

Starting from jsonc 0.10, `json_object_is_type()` started handling NULL
appropriately. With previous versions, calling this function with NULL
would lead to a segfault.

The version embedded in syslog-ng is recent enough. This fix is for
people using `--with-jsonc=system` and having a too old system jsonc
library (like the one in Ubuntu Precise).
@@ -221,6 +221,8 @@ json_dot_notation_eval(JSONDotNotation *self, struct json_object *jso)
JSONDotNotationElem *compiled;
gint i;

if (!jso) goto error;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the goto into a separate line.

@ihrwein
Copy link
Contributor

ihrwein commented Jul 21, 2015

There is only one review note from me. If you fix that, I give you my 👍 Thanks :)

@vincentbernat
Copy link
Contributor Author

Updated!

@ihrwein
Copy link
Contributor

ihrwein commented Jul 21, 2015

Then 👍

@bazsi
Copy link
Collaborator

bazsi commented Jul 21, 2015

👍 as well.

FYI: json-c is only bundled to make it easier to use by users,
distributions are expected to use the system libraries, that's why the
options are there in the first place.

Thanks for the patch.

Bazsi

On Tue, Jul 21, 2015 at 4:48 PM, Tibor Benke notifications@github.com
wrote:

Then [image: 👍]


Reply to this email directly or view it on GitHub
#578 (comment).

lbudai added a commit that referenced this pull request Jul 23, 2015
json: do not rely on json_object_is_type() accepting NULL
@lbudai lbudai merged commit 0fc42d8 into syslog-ng:master Jul 23, 2015
@nvxxu2i
Copy link
Contributor

nvxxu2i commented Jul 23, 2015

👍, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants