From a1e6dfcef67a056ccb930e111a025db46093c398 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 17 Nov 2012 16:52:01 -0500 Subject: [PATCH] Ensure that there is null terminator at the end of entitydefs. --- mwparserfromhell/parser/tokenizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mwparserfromhell/parser/tokenizer.c b/mwparserfromhell/parser/tokenizer.c index 18972aa..a8c69e7 100644 --- a/mwparserfromhell/parser/tokenizer.c +++ b/mwparserfromhell/parser/tokenizer.c @@ -1452,7 +1452,7 @@ init_tokenizer(void) Py_DECREF(htmlentitydefs); unsigned numdefs = (unsigned) PyDict_Size(defmap); - entitydefs = malloc(numdefs * sizeof(char*)); + entitydefs = calloc(numdefs + 1, sizeof(char*)); PyObject* deflist = PyDict_Keys(defmap); if (!deflist) return; Py_DECREF(defmap);