zmike pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=c81e4d508099525ff0098a24296cd0278a140abd

commit c81e4d508099525ff0098a24296cd0278a140abd
Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Oct 18 13:29:32 2019 -0400

    eina/convert: init endptr in failure case of eina_convert_strtod_c
    
    Summary:
    there is not any way to determine that this function has failed other
    than to check this pointer, so ensure that it always has a value which
    is meaningful in failure cases
    
    Reviewers: cedric
    
    Reviewed By: cedric
    
    Subscribers: #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D10445
---
 src/lib/eina/eina_convert.c | 1 +
 src/lib/eina/eina_convert.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lib/eina/eina_convert.c b/src/lib/eina/eina_convert.c
index 915ed7d563..f210d14d8a 100644
--- a/src/lib/eina/eina_convert.c
+++ b/src/lib/eina/eina_convert.c
@@ -476,6 +476,7 @@ eina_convert_strtod_c(const char *nptr, char **endptr)
    unsigned long long integer_part;
    int minus;
 
+   if (endptr) *endptr = (char*)nptr;
    EINA_SAFETY_ON_NULL_RETURN_VAL(nptr, 0.0);
 
    a = iter = nptr;
diff --git a/src/lib/eina/eina_convert.h b/src/lib/eina/eina_convert.h
index 337cd88ad8..314cd4cf92 100644
--- a/src/lib/eina/eina_convert.h
+++ b/src/lib/eina/eina_convert.h
@@ -337,9 +337,9 @@ EAPI Eina_Bool eina_convert_atofp(const char  *src,
  * @brief Converts a string to a floating point number.
  *
  * @param[in] nptr a string to convert. It shouldn't be NULL.
- * @param[out] endptr If endptr is not NULL, a pointer to the character after 
the last
+ * @param[out] endptr If @p endptr is not NULL, a pointer to the character 
after the last
  *                    character used in the conversion is stored in the 
location referenced
- *                    by endptr.
+ *                    by endptr. If @p nptr is NULL, this will also be set to 
NULL.
  * @return a double type floating point number.
  *
  * This function returns converted floating point number with 
locale-independency.

-- 


Reply via email to