]> granicus.if.org Git - onig/commitdiff
fix to initialize callout_data area in onig_initialize_match_param()
authorK.Kosako <kosako@sofnec.co.jp>
Mon, 26 Feb 2018 01:19:48 +0000 (10:19 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Mon, 26 Feb 2018 01:19:48 +0000 (10:19 +0900)
src/regexec.c

index 7a435fedbc7f2cb701c1aab1af63317280e071c1..ab134cadd97a10a68e43c2ba3875ed7979d93ca3 100644 (file)
@@ -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;
     }
   }