Bug 277456

Summary: netipsec: kdebug_sadb invalid length check for sadb_ext_len
Product: Base System Reporter: Tobias Heider <me>
Component: kernAssignee: freebsd-net (Nobody) <net>
Status: New ---    
Severity: Affects Only Me CC: me
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch
none
Updated Fix none

Description Tobias Heider 2024-03-03 16:30:20 UTC
Created attachment 248900 [details]
Patch

Besides not doing any sufficient check that the length of a parsed message is not bigger than the actual allocated buffer, kdebug_sadb() incorrectly compares ext->sadb_ext_len, the extension payload size in 8 byte chunks, with tlen, which is the full message payload size in bytes.

This should compare PFKEY_UNUNIT64(ext->sadb_ext_len) with tlen instead.
fix attached.
Comment 1 Tobias Heider 2024-03-03 23:26:55 UTC
Created attachment 248911 [details]
Updated Fix

Here's an updated diff. We can move extlen a few lines up and use that instead.