From 0a88a7ae3bb350d72712628078cf79517f627e99 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 10 Jul 2024 07:04:28 +0200 Subject: awk: mktime() with no arguments is not allowed It was SEGVing. Signed-off-by: Denys Vlasenko --- editors/awk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/editors/awk.c b/editors/awk.c index d4491d3e7..64e752f4b 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -509,7 +509,7 @@ static const uint32_t tokeninfo[] ALIGN4 = { OC_F|F_rn, OC_F|F_si|Nx|Rx, OC_F|F_sq|Nx|Rx, OC_F|F_sr|Nx, // rand sin sqrt srand OC_B|B_ge|_s_vv_|A3,OC_B|B_gs|ss_vv_|A2,OC_B|B_ix|_ss_vv|A2, // gensub gsub index /*length was here*/ OC_B|B_ma|__s__v|A2,OC_B|B_sp|__s_vv|A2,OC_SPRINTF, OC_B|B_su|ss_vv_|A2,// match split sprintf sub - OC_B|B_ss|__svvv|A2,OC_F|F_ti, OC_B|B_ti|__s_vv, OC_B|B_mt|__s_vv, // substr systime strftime mktime + OC_B|B_ss|__svvv|A2,OC_F|F_ti, OC_B|B_ti|__s_vv, OC_B|B_mt|__s_vv|A1,// substr systime strftime mktime OC_B|B_lo|__s__v|A1,OC_B|B_up|__s__v|A1, // tolower toupper OC_F|F_le|Sx, // length OC_GETLINE|SV, // getline @@ -2870,7 +2870,6 @@ static NOINLINE var *exec_builtin(node *op, var *res) tt = getvar_i(av[1]); else time(&tt); - //s = (nargs > 0) ? as[0] : "%a %b %d %H:%M:%S %Z %Y"; i = strftime(g_buf, MAXVARFMT, ((nargs > 0) ? as[0] : "%a %b %d %H:%M:%S %Z %Y"), localtime(&tt)); -- cgit v1.2.3-55-g6feb