git: df0fc3a43c48 - main - strto{u,}l.3: Fix base for which 0b prefix is accepted
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Nov 2026 15:09:58 UTC
The branch main has been updated by obiwac:
URL: https://cgit.FreeBSD.org/src/commit/?id=df0fc3a43c48bce41be8305ed13671d2fbe04ab9
commit df0fc3a43c48bce41be8305ed13671d2fbe04ab9
Author: Aymeric Wibo <obiwac@FreeBSD.org>
AuthorDate: 2026-11-11 15:08:40 +0000
Commit: Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2026-11-11 15:09:50 +0000
strto{u,}l.3: Fix base for which 0b prefix is accepted
Fixes: 76edfabbecde ("libc: Document support for binary integers.")
Sponsored by: Klara, Inc.
---
lib/libc/stdlib/strtol.3 | 6 ++++--
lib/libc/stdlib/strtoul.3 | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/libc/stdlib/strtol.3 b/lib/libc/stdlib/strtol.3
index 4a148ad63a51..2a76be7590b1 100644
--- a/lib/libc/stdlib/strtol.3
+++ b/lib/libc/stdlib/strtol.3
@@ -104,10 +104,12 @@ or
sign.
If
.Fa base
-is zero or 16,
+is zero or 2,
the string may then include a
.Dq Li 0b
-prefix, and the number will be read in base 2; or it may include a
+prefix, and the number will be read in base 2; if
+.Fa base
+is zero or 16, it may include a
.Dq Li 0x
prefix,
and the number will be read in base 16; otherwise, a zero
diff --git a/lib/libc/stdlib/strtoul.3 b/lib/libc/stdlib/strtoul.3
index b418f29ea0e0..931c6594ca36 100644
--- a/lib/libc/stdlib/strtoul.3
+++ b/lib/libc/stdlib/strtoul.3
@@ -104,10 +104,12 @@ or
sign.
If
.Fa base
-is zero or 16,
+is zero or 2,
the string may then include a
.Dq Li 0b
-prefix, and the number will be read in base 2; or it may include a
+prefix, and the number will be read in base 2; if
+.Fa base
+is zero or 16, it may include a
.Dq Li 0x
prefix,
and the number will be read in base 16; otherwise, a zero