Skip to content

linux: add NULL check for container->context->id - #2156

Merged
giuseppe merged 1 commit into
containers:mainfrom
clicelee:main
Aug 1, 2026
Merged

linux: add NULL check for container->context->id#2156
giuseppe merged 1 commit into
containers:mainfrom
clicelee:main

Conversation

@clicelee

@clicelee clicelee commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Closes: #2142
The calls to libcrun_get_state_directory() guard the state_root argument with a NULL check on container->context, but pass container->context->id unconditionally.
Apply the same defensive check to the id argument, as suggested in the issue discussion.
The same pattern appears in both do_notify_socket() and prepare_and_send_dev_mounts(), so fix both call sites.

The calls to libcrun_get_state_directory() guard the state_root argument with a NULL check on container->context, but pass container->context->id unconditionally.  Apply the same defensive check to the id argument, as suggested in the issue discussion.
The same pattern appears in both do_notify_socket() and prepare_and_send_dev_mounts(), so fix both call sites.

Signed-off-by: Jimin Lee <cliceleee@gmail.com>
@packit-as-a-service

Copy link
Copy Markdown

Ephemeral COPR build failed. @containers/packit-build please check.

@giuseppe giuseppe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@giuseppe
giuseppe merged commit 46cedc0 into containers:main Aug 1, 2026
34 of 46 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.

linux: ternary operator condition in do_notify_socket() always evaluates to true

2 participants