Bug 15597 - NULL_AFTER_DEREF in /source4/dsdb/samdb/ldb_modules/partition.c
Summary: NULL_AFTER_DEREF in /source4/dsdb/samdb/ldb_modules/partition.c
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Winbind (show other bugs)
Version: 4.16.11
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-02 15:53 UTC by e.bykhanova@fobos-nt.ru
Modified: 2024-03-05 20:31 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description e.bykhanova@fobos-nt.ru 2024-03-02 15:53:10 UTC
The static analyzer has detected NULL_AFTER_DEREF: Pointer 'data', which is dereferenced at partition.c:1165, is compared to a NULL value at partition.c:1176.

Seems that it's better to move 'if (data)' to partition.c:1165 in the following way: 'if (data && data->in_transaction == 0)' or get rid of this code at partition.c:1176 by replacing it with 'if (data->partitions)'. Otherwise, this condition allows NULL-dereference at partition.c:1165, or it's just a dead code.

GitHub:
1) partition.c:1176
https://github.com/samba-team/samba/blob/225a003a043eee399b6d266d94440c399b6877e4/source4/dsdb/samdb/ldb_modules/partition.c#L1176

2) partition.c:1165
https://github.com/samba-team/samba/blob/225a003a043eee399b6d266d94440c399b6877e4/source4/dsdb/samdb/ldb_modules/partition.c#L1165


Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.

Author E. Bykhanova (e.bykhanova@fobos-nt.ru).