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

pj_open_lib_ex() doesn't size check name #1489

Closed
abellgithub opened this issue May 28, 2019 · 3 comments

Comments

@abellgithub
Copy link
Contributor

commented May 28, 2019

pj_open_lib_ex() references *name without checking that name is not null. It also attempts to read name[1] without checking that it's accessible.

rouault added a commit that referenced this issue May 29, 2019

@rouault

This comment has been minimized.

Copy link
Member

commented May 29, 2019

I don't see this as a bug. This is part of the contract of the function that name must not be null. Like it is undefined behaviour if you do fopen(NULL, mode).
I've added an extra comment in the doc of pj_find_file() regarding that

@abellgithub

This comment has been minimized.

Copy link
Contributor Author

commented May 29, 2019

That's fine. Also note that there's an issue with a null string ("").

@rouault

This comment has been minimized.

Copy link
Member

commented May 29, 2019

there's an issue with a null string ("").

Ah, right, I missed initially the case of || (name[1] == ':' && strchr(dir_chars,name[2])) ). Will fix

rouault added a commit that referenced this issue May 29, 2019

rouault added a commit that referenced this issue May 29, 2019

@kbevers kbevers added this to the 6.1.1 milestone May 29, 2019

@kbevers kbevers added the bug label May 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.