]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Allocate space for buf on heap (modified PR #1324)
authorFlole998 <Flole998@users.noreply.github.com>
Mon, 8 Jun 2020 19:46:22 +0000 (21:46 +0200)
committerGitHub <noreply@github.com>
Mon, 8 Jun 2020 19:46:22 +0000 (21:46 +0200)
src/epggrab/module/xmltv.c

index d48bdbbb1e22263a8e7b1b1e650b4221ef1b77c4..fa36640f7e128a7d57968ac92d00036a3bed8365 100644 (file)
@@ -197,7 +197,8 @@ static void parse_xmltv_dd_progid
   (epggrab_module_t *mod, const char *s, char **uri, char **suri,
    epg_episode_num_t *epnum)
 {
-  if (strlen(s) < 2) return;
+  const int s_len = strlen(s);
+  if (s_len < 2) return;
 
   const int buf_size = s_len + strlen(mod->id) + 13;
   char * buf = (char *) malloc( buf_size);
@@ -212,7 +213,6 @@ static void parse_xmltv_dd_progid
 
   /* Episode */
   if (!strncmp("EP", s, 2)) {
-    int e = strlen(buf)-1;
     while (--e && buf[e] != '.') {}
     if (e) {
       buf[e] = '\0';