Commit 7206a8c4 authored by cremno's avatar cremno

fix dangling pointer

CID 75872 (#3-2 of 3): Pointer to local outside scope (RETURN_LOCAL)
38. use_invalid: Using p, which points to an out-of-scope variable buf.
parent ff49cf95
......@@ -2057,6 +2057,7 @@ MRB_API double
mrb_cstr_to_dbl(mrb_state *mrb, const char * p, mrb_bool badcheck)
{
char *end;
char buf[DBL_DIG * 4 + 10];
double d;
enum {max_width = 20};
......@@ -2077,7 +2078,6 @@ bad:
return d;
}
if (*end) {
char buf[DBL_DIG * 4 + 10];
char *n = buf;
char *e = buf + sizeof(buf) - 1;
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