From cba65a98f73a7a31e2acc55e19a7f8508a740355 Mon Sep 17 00:00:00 2001 From: anton Date: Thu, 29 Aug 2024 07:33:50 +0000 Subject: [PATCH] Fix regression introduced in previous migration to strtol() by correcting the error condition, making it on par with the example in the manual. ok op@ --- lib/libpcap/scanner.l | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libpcap/scanner.l b/lib/libpcap/scanner.l index a738b252ba1..86a1936b908 100644 --- a/lib/libpcap/scanner.l +++ b/lib/libpcap/scanner.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: scanner.l,v 1.31 2024/08/28 11:40:33 op Exp $ */ +/* $OpenBSD: scanner.l,v 1.32 2024/08/29 07:33:50 anton Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -344,7 +344,7 @@ stoi(char *s) errno = 0; lval = strtol(s, &ep, 0); - if (*s == '\0' || *ep == '\0') + if (*s == '\0' || *ep != '\0') bpf_error("invalid number %s", s); if ((errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN)) || (lval > INT_MAX || lval < INT_MIN)) -- 2.20.1