From 0c216e5f16581e18a381ae73a4b2b478dfcd9f81 Mon Sep 17 00:00:00 2001 From: ValKmjolnir Date: Sun, 30 Oct 2022 01:30:05 +0800 Subject: [PATCH] :bug: safer builtin_logtime --- nasal_builtin.h | 2 +- nasal_opt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nasal_builtin.h b/nasal_builtin.h index 6e6e59d..4aa723f 100644 --- a/nasal_builtin.h +++ b/nasal_builtin.h @@ -1123,7 +1123,7 @@ var builtin_logtime(var* local,gc& ngc) { time_t t=time(nullptr); tm* tm_t=localtime(&t); - char s[32]; + char s[128]; sprintf(s,"%d-%.2d-%.2d %.2d:%.2d:%.2d",tm_t->tm_year+1900,tm_t->tm_mon+1,tm_t->tm_mday,tm_t->tm_hour,tm_t->tm_min,tm_t->tm_sec); return ngc.newstr(s); } diff --git a/nasal_opt.h b/nasal_opt.h index 5494db6..8955cd5 100644 --- a/nasal_opt.h +++ b/nasal_opt.h @@ -13,7 +13,7 @@ void const_str(ast& root) void const_num(ast& root) { auto& vec=root.child(); - f64 res; + f64 res=0; switch(root.type()) { case ast_add: res=vec[0].num()+vec[1].num(); break;