From: Flole998 Date: Mon, 8 Jun 2020 19:43:18 +0000 (+0200) Subject: Allocate space for buf on heap (modified PR #1324) X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=8bd059550c641fcaae3a360c527ada6ec74ce9e7;p=thirdparty%2Ftvheadend.git Allocate space for buf on heap (modified PR #1324) --- diff --git a/src/epggrab/module/xmltv.c b/src/epggrab/module/xmltv.c index 34ab05bdb..d48bdbbb1 100644 --- a/src/epggrab/module/xmltv.c +++ b/src/epggrab/module/xmltv.c @@ -197,11 +197,12 @@ static void parse_xmltv_dd_progid (epggrab_module_t *mod, const char *s, char **uri, char **suri, epg_episode_num_t *epnum) { - char buf[128]; if (strlen(s) < 2) return; + const int buf_size = s_len + strlen(mod->id) + 13; + char * buf = (char *) malloc( buf_size); /* Raw URI */ - snprintf(buf, sizeof(buf)-1, "ddprogid://%s/%s", mod->id, s); + int e = snprintf( buf, buf_size, "ddprogid://%s/%s", mod->id, s); /* SH - series without episode id so ignore */ if (strncmp("SH", s, 2)) @@ -212,7 +213,7 @@ static void parse_xmltv_dd_progid /* Episode */ if (!strncmp("EP", s, 2)) { int e = strlen(buf)-1; - while (e && buf[e] != '.') e--; + while (--e && buf[e] != '.') {} if (e) { buf[e] = '\0'; *suri = strdup(buf);