changeset 11074:8cf858130820

c-strtod: when ENDPTR is non-NULL, set *ENDPTR in new failure path * lib/c-strtod.c (C_STRTOD) [LC_ALL_MASKC]: Ensure that when ENDPTR is non-NULL, *ENDPTR is set to NPTR upon failure.
author Jim Meyering <meyering@redhat.com>
date Fri, 23 Jan 2009 16:21:57 +0100
parents 5d673ad5f710
children ab7203b2967c
files ChangeLog lib/c-strtod.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-23  Jim Meyering  <meyering@redhat.com>
+
+	c-strtod: when ENDPTR is non-NULL, set *ENDPTR in new failure path
+	* lib/c-strtod.c (C_STRTOD) [LC_ALL_MASKC]: Ensure that when
+	ENDPTR is non-NULL, *ENDPTR is set to NPTR upon failure.
+
 2009-01-23  Simon Josefsson  <simon@josefsson.org>
 
 	* lib/version-etc.c: Add emit_bug_reporting_address, inspired by
--- a/lib/c-strtod.c
+++ b/lib/c-strtod.c
@@ -72,7 +72,11 @@
 
   locale_t locale = c_locale ();
   if (!locale)
-    return 0; /* errno is set here */
+    {
+      if (endptr)
+        *endptr = nptr;
+      return 0; /* errno is set here */
+    }
 
   r = STRTOD_L (nptr, endptr, locale);