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
F137971963: D47614.id146547.diff
Thu, Nov 27, 7:24 PM
Unknown Object (File)
Fri, Nov 21, 12:06 PM
Unknown Object (File)
Tue, Nov 4, 3:03 AM
Unknown Object (File)
Sun, Nov 2, 4:01 AM
Unknown Object (File)
Sat, Nov 1, 11:12 AM
Unknown Object (File)
Oct 25 2025, 12:18 PM
Unknown Object (File)
Oct 24 2025, 5:45 PM
Unknown Object (File)
Oct 22 2025, 4:37 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 60809
Build 57693: arc lint + arc unit

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.Nov 27 2024, 1:58 PM

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

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