summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTAKAI Kousuke <62541129+t-a-k@users.noreply.github.com>2022-03-03 23:09:05 +0900
committerKarl Williamson <khw@cpan.org>2022-03-05 12:00:47 -0700
commitb4603d09e3b40cd371926f222a143c4adf8a7a38 (patch)
tree945d81929c9d77fd7eed185ff124f92e01ea1ca6
parent61cf68d3b867f5469c24d79f9842d5f54735532f (diff)
downloadperl-b4603d09e3b40cd371926f222a143c4adf8a7a38.tar.gz
numeric.c: Fix possible null pointer dereferences
Previous code apparently dereferences a variable initialized to NULL.
-rw-r--r--numeric.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/numeric.c b/numeric.c
index de64ab479d..a9f70622de 100644
--- a/numeric.c
+++ b/numeric.c
@@ -108,14 +108,14 @@ Perl_my_strtod(const char * const s, char **e)
{
NV result;
- char ** end_ptr = NULL;
+ char * end_ptr;
- *end_ptr = my_atof2(s, &result);
+ end_ptr = my_atof2(s, &result);
if (e) {
- *e = *end_ptr;
+ *e = end_ptr;
}
- if (! *end_ptr) {
+ if (! end_ptr) {
result = 0.0;
}