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
Closed

pj_open_lib_ex() doesn't size check name #1489

abellgithub opened this issue May 28, 2019 · 3 comments
Labels
Milestone

Comments

@abellgithub
Copy link
Contributor

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
Copy link
Member

rouault 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
Copy link
Contributor Author

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

@rouault
Copy link
Member

rouault 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
Labels
Projects
None yet
Development

No branches or pull requests

3 participants