Commit 5cfc0d0d authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2877 from cremno/fix-dangling-ptr

Coverity: fix dangling pointer
parents 5daabc94 7206a8c4
...@@ -2057,6 +2057,7 @@ MRB_API double ...@@ -2057,6 +2057,7 @@ MRB_API double
mrb_cstr_to_dbl(mrb_state *mrb, const char * p, mrb_bool badcheck) mrb_cstr_to_dbl(mrb_state *mrb, const char * p, mrb_bool badcheck)
{ {
char *end; char *end;
char buf[DBL_DIG * 4 + 10];
double d; double d;
enum {max_width = 20}; enum {max_width = 20};
...@@ -2077,7 +2078,6 @@ bad: ...@@ -2077,7 +2078,6 @@ bad:
return d; return d;
} }
if (*end) { if (*end) {
char buf[DBL_DIG * 4 + 10];
char *n = buf; char *n = buf;
char *e = buf + sizeof(buf) - 1; char *e = buf + sizeof(buf) - 1;
char prev = 0; char prev = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment