Module Name:    src
Committed By:   riastradh
Date:           Fri Nov  4 20:06:09 UTC 2016

Modified Files:
        src/lib/libc/stdlib: strtod.3

Log Message:
Distinguish altogether invalid syntax from trailing garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libc/stdlib/strtod.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdlib/strtod.3
diff -u src/lib/libc/stdlib/strtod.3:1.26 src/lib/libc/stdlib/strtod.3:1.27
--- src/lib/libc/stdlib/strtod.3:1.26	Fri Nov  4 20:04:04 2016
+++ src/lib/libc/stdlib/strtod.3	Fri Nov  4 20:06:09 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strtod.3,v 1.26 2016/11/04 20:04:04 riastradh Exp $
+.\"	$NetBSD: strtod.3,v 1.27 2016/11/04 20:06:09 riastradh Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -198,8 +198,10 @@ double d;
 
 errno = 0;
 d = strtod(s, &end);
-if (s[0] == '\e0' || end[0] != '\e0')
+if (end == s)
 	errx(EXIT_FAILURE, "invalid syntax");
+if (end[0] != '\e0')
+	errx(EXIT_FAILURE, "trailing garbage");
 if (errno) {
 	assert(errno == ERANGE);
 	assert(isinf(d) || d == 0 ||

Reply via email to