summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/strtol.36
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdlib/strtol.3 b/lib/libc/stdlib/strtol.3
index 66b4b0bb9ad..b7065051f07 100644
--- a/lib/libc/stdlib/strtol.3
+++ b/lib/libc/stdlib/strtol.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: strtol.3,v 1.35 2015/11/13 16:00:32 christos Exp $
+.\" $NetBSD: strtol.3,v 1.36 2016/11/04 20:14:31 riastradh Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -225,8 +225,10 @@ long lval;
errno = 0;
lval = strtol(buf, \*[Am]ep, 10);
-if (buf[0] == '\e0' || *ep != '\e0')
+if (ep == buf)
goto not_a_number;
+if (*ep != '\e0')
+ goto trailing_garbage;
if (errno == ERANGE \*[Am]\*[Am] (lval == LONG_MAX || lval == LONG_MIN))
goto out_of_range;
.Ed