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

possible NULL pointer dereference #127

Closed
setharnold opened this issue Feb 9, 2021 · 2 comments
Closed

possible NULL pointer dereference #127

setharnold opened this issue Feb 9, 2021 · 2 comments

Comments

@setharnold
Copy link

Hello, I'm giving inih a quick look as part of the Ubuntu main inclusion process. Part of this process is a very quick security review.

Coverity has pointed out that the strcmp() in unittest.c may dereference a null pointer -- given the printf() lines above try to account for a null pointer, it seems plausible.

return strcmp(name, "user")==0 && strcmp(value, "parse_error")==0 ? 0 : 1;

Of course this is a test suite and if it dies with a segfault, that might be better than papering over an error here. What do you think about adding a non-null assert in this function to declare that it's impossible? I think that would placate coverity and be noisy about this kind of failure.

Thanks

@benhoyt benhoyt closed this as completed in e492a25 Feb 9, 2021
@benhoyt
Copy link
Owner

benhoyt commented Feb 9, 2021

Thanks @setharnold (and hi fellow Canonical employee :-). Just pushed a fix for this. This can actually happen if INI_ALLOW_NO_VALUE is set and the line has no value (a combination which didn't occur in the current test files, but worth checking anyway). Thanks.

Want me to tag a new release? (r54)

@setharnold
Copy link
Author

Hello Ben, no, no need for a new release for this. Thanks for the quick turnaround :)

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

No branches or pull requests

2 participants