Page MenuHomeFreeBSD

MAC/do: Better parsing for IDs (strtoui_strict())
ClosedPublic

Authored by olce on Nov 15 2024, 5:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 3:32 AM
Unknown Object (File)
Thu, Dec 12, 7:52 AM
Unknown Object (File)
Mon, Dec 9, 11:08 AM
Unknown Object (File)
Nov 21 2024, 9:28 PM
Unknown Object (File)
Nov 19 2024, 3:25 PM
Unknown Object (File)
Nov 18 2024, 6:16 PM
Unknown Object (File)
Nov 18 2024, 4:54 PM
Unknown Object (File)
Nov 18 2024, 9:52 AM

Details

Summary

This revision is part of a series. Click on the Stack tab below to see the context.
This series has also been squeezed into D47633 to provide an overall view.

Commit message:
Introduce strtoui_strict(), which signals an error on overflow contrary
to the in-kernel strto*() family of functions which have no 'errno' to
set and thus do not allow callers to distinguish a genuine maximum value
on input and overflow.

It is built on top of strtoq() and the 'quad_t' type in order to achieve
this distinction and also to still support negative inputs with the
usual meaning for these functions. See the introduced comments for more
details.

Use strtoui_strict() to read IDs instead of strtol().

Diff Detail

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

Event Timeline

olce requested review of this revision.Nov 15 2024, 5:08 PM
This revision is now accepted and ready to land.Nov 19 2024, 8:06 AM
olce retitled this revision from MAC/do: Better parsing for IDs to MAC/do: Better parsing for IDs (strtoui_strict()).
olce edited the summary of this revision. (Show Details)

Replace strtonni with strotui_strict().

This is a followup to the change in D47613 (u_int used for IDs). Took the
occasion to provide a better implementation that supports negative number
specifications (as strtou*() standard functions do).

This revision now requires review to proceed.Wed, Nov 27, 1:58 PM

Remove a redundant check that was forgotten in the previous update.

This revision is now accepted and ready to land.Mon, Dec 2, 8:57 AM