Page MenuHomeFreeBSD

ctld: Fix assertion against the wrong field
ClosedPublic

Authored by jhb on Jan 23 2025, 3:50 PM.
Tags
None
Referenced Files
F111978956: D48622.diff
Tue, Mar 11, 2:57 AM
Unknown Object (File)
Tue, Feb 25, 9:41 AM
Unknown Object (File)
Wed, Feb 19, 6:15 AM
Unknown Object (File)
Tue, Feb 18, 9:18 PM
Unknown Object (File)
Feb 7 2025, 4:28 AM
Unknown Object (File)
Feb 4 2025, 8:39 PM
Unknown Object (File)
Feb 4 2025, 6:09 AM
Unknown Object (File)
Feb 4 2025, 5:45 AM
Subscribers

Diff Detail

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

Event Timeline

jhb requested review of this revision.Jan 23 2025, 3:50 PM

I guess this is OK, but I haven't ever done anything with the discovery code, so I don't know how it's supposed to work.

This revision is now accepted and ready to land.Jan 23 2025, 4:15 PM

yea, this field is a pointer.

usr.sbin/ctld/discovery.c
164

As Warner noted, pg_discovery_filter is an integer field that holds one of the PG_FILTER_* values (an enum in essence), while pg_discovery_auth_group is a pointer to a struct auth_group. This is a type mismatch comparing a pointer to an integer. Not sure why the compiler didn't complain about this earlier. Maybe if PG_FILTER_UNKNOWN is 0 then it gets treated as NULL.

166

Here you can see the PG_FILTER_ values being compared against the integer field.

183

Here you can see the pointer dereferenced.

This revision was automatically updated to reflect the committed changes.