From 9977632d05c1d68363901d6a4f4743ce06f153d2 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 23 Jan 2009 16:21:57 +0100 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ lib/c-strtod.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ca3742587..66a6632c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-01-23 Jim Meyering + + 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 * lib/version-etc.c: Add emit_bug_reporting_address, inspired by diff --git a/lib/c-strtod.c b/lib/c-strtod.c index 3d0fae995..77e5aaf80 100644 --- a/lib/c-strtod.c +++ b/lib/c-strtod.c @@ -72,7 +72,11 @@ C_STRTOD (char const *nptr, char **endptr) 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); -- 2.11.0