Skip to content

edns-subnet: fix NULL_AFTER_DEREF on subnetmod - #1297

Merged
wcawijngaards merged 1 commit into
NLnetLabs:masterfrom
bewflast:fix/null-after-deref
Jun 19, 2025
Merged

wcawijngaards merged 1 commit into
NLnetLabs:masterfrom
bewflast:fix/null-after-deref

Conversation

@bewflast

Copy link
Copy Markdown
Contributor

Found by static analyzer svace.
Static analyzer message: Redundant comparison with a NULL value at subnetmod.c:236 for pointer 'sn_env->subnet_msg_cache', which was dereferenced at slabhash.c:228 by passing as 1st parameter to function 'slabhash_setmarkdel' at subnetmod.c:235.

Moved usage of sn_env->subnet_msg_cache in slabhash_setmarkdel after checking.

Found by static analyzer svace.
Static analyzer message: Redundant comparison with a NULL value at subnetmod.c:236 for pointer 'sn_env->subnet_msg_cache',
which was dereferenced at slabhash.c:228 by passing as 1st parameter to function 'slabhash_setmarkdel' at subnetmod.c:235.

Moved usage of sn_env->subnet_msg_cache in slabhash_setmarkdel after checking.

Signed-off-by: Konstantin Kamanin <bewflast@gmail.com>

@wcawijngaards wcawijngaards 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.

The code patch fixes the analyzer warning. The code deals with alloc failure in a better way, so that is nice.

@wcawijngaards
wcawijngaards merged commit d3f88d0 into NLnetLabs:master Jun 19, 2025
wcawijngaards added a commit that referenced this pull request Jun 19, 2025
- Merge #1297: edns-subnet: fix NULL_AFTER_DEREF on subnetmod.
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.

2 participants