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

Verify absolute path creation #79

Merged
merged 2 commits into from
Aug 17, 2024

Conversation

stoeckmann
Copy link
Contributor

If a relative path is supplied, the conversion to an absolute path can fail, e.g. if current working directory does not exist anymore.

Proof of Concept:

MYPATH=$(mktemp -d)
cd $MYPATH
rmdir $MYPATH
depmod -b relative

The depmod command actually processes system files, because turning relative into an absolute path failed and returned NULL. NULL in turn is interpreted as default, i.e. to use default paths.

Copy link
Collaborator

@evelikov evelikov left a comment

Choose a reason for hiding this comment

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

Nicely spotted - didn't knew about this implication of removing cwd.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>

If a relative path is supplied, the conversion to an absolute path can
fail, e.g. if current working directory does not exist anymore.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: kmod-project#79
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Calling free(NULL) is valid. No need for previous if-check.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: kmod-project#79
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
@lucasdemarchi lucasdemarchi merged commit 34aaf08 into kmod-project:master Aug 17, 2024
7 checks passed
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.

3 participants