Page MenuHomeFreeBSD

ng_parse: disallow negative length for malloc
ClosedPublic

Authored by emaste on Nov 1 2022, 2:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 11:07 PM
Unknown Object (File)
Thu, Nov 21, 11:07 PM
Unknown Object (File)
Thu, Nov 21, 11:07 PM
Unknown Object (File)
Thu, Nov 21, 11:07 PM
Unknown Object (File)
Thu, Nov 21, 10:49 PM
Unknown Object (File)
Thu, Nov 21, 8:55 PM
Unknown Object (File)
Sun, Nov 17, 11:00 AM
Unknown Object (File)
Sep 27 2024, 7:16 PM

Details

Summary
PR:             267334
Reported by:    Robert Morris <rtm@lcs.mit.edu>
Sponsored by:   The FreeBSD Foundation

Diff Detail

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

Event Timeline

emaste requested review of this revision.Nov 1 2022, 2:12 PM

just return, foff is not yet set

glebius requested changes to this revision.Nov 2 2022, 6:14 PM

Can we return unsigned value from ng_get_composite_len() instead?

This revision now requires changes to proceed.Nov 2 2022, 6:14 PM

Looking at 267334. IMHO, we should return the error for invalid message as close as possible to the userland. Don't let the invalid data travel this down.

Of course we should also check for num nonnegative and too large; there's probably more to be covered here too.

Can we return unsigned value from ng_get_composite_len() instead?

We should, but I think there are ABI considerations to take into account and we really need someone who understands netgraph well.

I'm going to commit this as an interim improvement. We can revisit ng_get_composite_len's return type and error handling later on.

This revision was not accepted when it landed; it landed in state Needs Revision.Thu, Nov 21, 8:56 PM
This revision was automatically updated to reflect the committed changes.