Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/stdlib Distinguish altogether invalid syntax from t...



details:   https://anonhg.NetBSD.org/src/rev/ee2a8e6a0d4e
branches:  trunk
changeset: 818880:ee2a8e6a0d4e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Nov 04 20:06:09 2016 +0000

description:
Distinguish altogether invalid syntax from trailing garbage.

diffstat:

 lib/libc/stdlib/strtod.3 |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r bde67ec50b3c -r ee2a8e6a0d4e lib/libc/stdlib/strtod.3
--- a/lib/libc/stdlib/strtod.3  Fri Nov 04 20:04:11 2016 +0000
+++ b/lib/libc/stdlib/strtod.3  Fri Nov 04 20:06:09 2016 +0000
@@ -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 @@
 
 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 ||



Home | Main Index | Thread Index | Old Index