Page MenuHomeFreeBSD

btree/bt_seq.c: Fix two NULL pointer dereferences
ClosedPublic

Authored by bnovkov on Jan 27 2026, 3:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 1, 4:15 AM
Unknown Object (File)
Mon, Feb 16, 6:00 AM
Unknown Object (File)
Sun, Feb 15, 10:48 PM
Unknown Object (File)
Fri, Feb 13, 11:41 AM
Unknown Object (File)
Wed, Feb 11, 2:08 PM
Unknown Object (File)
Wed, Feb 11, 1:33 PM
Unknown Object (File)
Mon, Feb 9, 9:57 PM
Unknown Object (File)
Feb 9 2026, 2:23 AM
Subscribers

Details

Summary

This change fixes two NULL pointer dereferences caused by the
__bt_first function.

The first was caused by returning 0 (i.e., RET_SUCCESS) when a key
was not found, causing the caller to dereference an uninitalized
or NULL pointer. The second one was caused by an if statment clobbering
a local variable with a function call result that might be NULL.

Reported by: clang-tidy
Sponsored by; Klara, Inc.
Obtained from: https://github.com/apple-oss-distributions/libc (partially)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable