Module: wine Branch: master Commit: abbb361733f8d266132144f391d2d3d7a6a65d4e URL: http://source.winehq.org/git/wine.git/?a=commit;h=abbb361733f8d266132144f391...
Author: Sebastian Lackner sebastian@fds-team.de Date: Mon Jun 29 03:42:34 2015 +0200
msvcrt: Set *end to NULL when strtod is called with NULL pointer string.
---
dlls/msvcrt/string.c | 7 +++++-- dlls/msvcrt/tests/string.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index fdeb4e0..980d492 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -317,8 +317,11 @@ static double strtod_helper(const char *str, char **end, MSVCRT__locale_t locale
if(err) *err = 0; - else - if(!MSVCRT_CHECK_PMT(str != NULL)) return 0; + else if(!MSVCRT_CHECK_PMT(str != NULL)) { + if (end) + *end = NULL; + return 0; + }
if(!locale) locinfo = get_locinfo(); diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index e8cafc8..5768c0f 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -1694,7 +1694,7 @@ static void test__strtod(void) d = strtod(NULL, &end); ok(almost_equal(d, 0.0), "d = %lf\n", d); ok(errno == EINVAL, "errno = %x\n", errno); - todo_wine ok(!end, "incorrect end ptr %p\n", end); + ok(!end, "incorrect end ptr %p\n", end);
errno = EBADF; d = p__strtod_l(NULL, NULL, NULL);