summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-07-07 07:40:38 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-07-07 07:40:38 +0900
commit5cfc0d0dc07e4051411819dd6036ca20c401b531 (patch)
treef3f410aa370acf29e122334444d4ba09d78f5c74 /src
parent5daabc940767d658e9017cf02c5d0e96fc29f7f7 (diff)
parent7206a8c4f91bd54390b6e244d6a32f9766b8e05f (diff)
downloadmruby-5cfc0d0dc07e4051411819dd6036ca20c401b531.tar.gz
mruby-5cfc0d0dc07e4051411819dd6036ca20c401b531.zip
Merge pull request #2877 from cremno/fix-dangling-ptr
Coverity: fix dangling pointer
Diffstat (limited to 'src')
-rw-r--r--src/string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c
index 57b5eef9a..45ba38c9d 100644
--- a/src/string.c
+++ b/src/string.c
@@ -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;