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

Null ptr check missing from local strdup #4

Open
JanneKiiskila opened this issue Jan 2, 2019 · 3 comments
Open

Null ptr check missing from local strdup #4

JanneKiiskila opened this issue Jan 2, 2019 · 3 comments

Comments

@JanneKiiskila
Copy link

JanneKiiskila commented Jan 2, 2019

The implementation of local strdup is not checking for ret being NULL.

https://github.com/WigWagCo/greaseLog/blob/master/local_strdup.c#L25-L26

Standard seems to specify that with invalid values (such as NULL) the behaviour is undefined, which in most cases means a crash. Which is made sure by this line:

	*(ret+n) = '\0';

That pretty much guarantees a memory overwrite to user space address 0+n.

@edhemphill
Copy link
Contributor

Thanks Janne - i'll fix this in https://github.com/WigWagCo/greaseLib - which is the new version of this code. This is basically deprecated.

@JanneKiiskila
Copy link
Author

JanneKiiskila commented Oct 7, 2021

PR created - #5
Is there a CI that tests this? Is the overlaying upper system capable of dealing with NULLPTR? @edhemphill @x85446

@JanneKiiskila
Copy link
Author

Seems that this repo is the active one anyway, the link points to a repo that's been archived.

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