From: malc Date: Fri, 23 Nov 2012 06:02:35 +0000 (+0400) Subject: Do not forget to zero terminate the string X-Git-Tag: v14~95 X-Git-Url: https://repo.or.cz/w/llpp.git/commitdiff_plain/5bee2de8f914f087f7caf511312a99df55607325 Do not forget to zero terminate the string --- diff --git a/link.c b/link.c index 86e7156..4f014fd 100644 --- a/link.c +++ b/link.c @@ -1513,7 +1513,7 @@ static char *mbtoutf8 (char *s) len += fz_runelen (tmp[i]); } - p = r = malloc (len); + p = r = malloc (len + 1); if (!r) { free (tmp); return s; @@ -1522,6 +1522,7 @@ static char *mbtoutf8 (char *s) for (i = 0; i < ret; ++i) { p += fz_runetochar (p, tmp[i]); } + *p = 0; return r; }