git: 8c47cbc97a17 - stable/15 - hexdump: Support octal and hex for -N option

From: ShengYi Hung <aokblast_at_FreeBSD.org>
Date: Fri, 09 Oct 2026 22:18:58 UTC
The branch stable/15 has been updated by aokblast:

URL: https://cgit.FreeBSD.org/src/commit/?id=8c47cbc97a17dbf0ce55aff65546f54fdf9a0a7e

commit 8c47cbc97a17dbf0ce55aff65546f54fdf9a0a7e
Author:     ShengYi Hung <aokblast@FreeBSD.org>
AuthorDate: 2026-07-07 04:49:48 +0000
Commit:     ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-10-09 22:18:54 +0000

    hexdump: Support octal and hex for -N option
    
    GNU hexdump supports octal and hex, we add supports for BSD style
    hexdump for better compatibility.
    
    See: https://github.com/llvm/llvm-project/pull/206581/
    
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D58074
    
    (cherry picked from commit b8f1972d51cf93ba4393d621b126dbd408423b87)
---
 usr.bin/hexdump/odsyntax.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.bin/hexdump/odsyntax.c b/usr.bin/hexdump/odsyntax.c
index 6c7ca55c3232..62d427a86e5d 100644
--- a/usr.bin/hexdump/odsyntax.c
+++ b/usr.bin/hexdump/odsyntax.c
@@ -139,7 +139,7 @@ oldsyntax(int argc, char ***argvp)
 				errx(1, "%s: invalid skip amount", optarg);
 			break;
 		case 'N':
-			if ((length = atoi(optarg)) <= 0)
+			if ((length = strtol(optarg, NULL, 0)) <= 0)
 				errx(1, "%s: invalid length", optarg);
 			break;
 		case 'O':