From: K.Kosako Date: Mon, 26 Feb 2018 01:19:48 +0000 (+0900) Subject: fix to initialize callout_data area in onig_initialize_match_param() X-Git-Tag: v6.8.0~167 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ce47ecaeef3ce0c129d1eb3028473c8261d158f;p=onig fix to initialize callout_data area in onig_initialize_match_param() --- diff --git a/src/regexec.c b/src/regexec.c index 7a435fe..ab134ca 100644 --- a/src/regexec.c +++ b/src/regexec.c @@ -1196,9 +1196,10 @@ onig_initialize_match_param(regex_t* reg, OnigMatchParam* mp) RegexExt* ext = REG_EXTP(reg); if (ext->callout_num > 0) { CalloutData* d; - int n = ONIG_CALLOUT_DATA_SLOT_NUM * ext->callout_num; - d = (CalloutData* )xmalloc(sizeof(*d) * n); + size_t n = ONIG_CALLOUT_DATA_SLOT_NUM * ext->callout_num * sizeof(*d); + d = (CalloutData* )xmalloc(n); CHECK_NULL_RETURN_MEMERR(d); + xmemset(d, 0, n); mp->callout_data = d; } }