[oe-commits] [meta-openembedded] 03/07: tvheadend: Fix format-truncation warnings

git at git.openembedded.org git at git.openembedded.org
Fri Dec 27 03:57:56 UTC 2019


This is an automated email from the git hooks/post-receive script.

khem pushed a commit to branch master-next
in repository meta-openembedded.

commit 70902f79e8b796a10c1d84a0e4ebfb8f6f9f695d
Author: Khem Raj <raj.khem at gmail.com>
AuthorDate: Wed Dec 25 14:01:27 2019 -0800

    tvheadend: Fix format-truncation warnings
    
    Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 .../0001-allocate-space-for-buf-on-heap.patch      | 46 ++++++++++++++++++++++
 .../recipes-dvb/tvheadend/tvheadend_git.bb         |  1 +
 2 files changed, 47 insertions(+)

diff --git a/meta-multimedia/recipes-dvb/tvheadend/tvheadend/0001-allocate-space-for-buf-on-heap.patch b/meta-multimedia/recipes-dvb/tvheadend/tvheadend/0001-allocate-space-for-buf-on-heap.patch
new file mode 100644
index 0000000..cbd76b6
--- /dev/null
+++ b/meta-multimedia/recipes-dvb/tvheadend/tvheadend/0001-allocate-space-for-buf-on-heap.patch
@@ -0,0 +1,46 @@
+From d4a405f87fc215c14e610a25b5a6b14060c1ef15 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Wed, 25 Dec 2019 13:53:52 -0800
+Subject: [PATCH] allocate space for buf on heap
+
+Avoids
+| src/epggrab/module/xmltv.c:204:47: error: '%s' directive output may be truncated writing between 2 and 2147483645 bytes into a region of size 115 [-Werror=format-truncation=]
+|   204 |   snprintf(buf, sizeof(buf)-1, "ddprogid://%s/%s", mod->id, s);
+|       |                                               ^~
+
+Upstream-Status: Submitted [https://github.com/tvheadend/tvheadend/pull/1324]
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+ src/epggrab/module/xmltv.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/epggrab/module/xmltv.c b/src/epggrab/module/xmltv.c
+index 34ab05bdb..b1a956614 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;
+ 
++  char* buf = (char *)malloc(strlen(s) + strlen(mod->id) + 13);
++  buf[strlen(s) + strlen(mod->id) + 12] = '\0';
+   /* Raw URI */
+-  snprintf(buf, sizeof(buf)-1, "ddprogid://%s/%s", mod->id, s);
++  snprintf(buf, strlen(s) + strlen(mod->id) + 12, "ddprogid://%s/%s", mod->id, s);
+ 
+   /* SH - series without episode id so ignore */
+   if (strncmp("SH", s, 2))
+@@ -219,6 +220,7 @@ static void parse_xmltv_dd_progid
+       if (buf[e+1]) sscanf(&buf[e+1], "%hu", &(epnum->e_num));
+     }
+   }
++  free(buf);
+ }
+ 
+ /**
+-- 
+2.24.1
+
diff --git a/meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb b/meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb
index a818a96..20faef0 100644
--- a/meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb
+++ b/meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb
@@ -10,6 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=9cae5acac2e9ee2fc3aec01ac88ce5db"
 
 SRC_URI = "git://github.com/tvheadend/tvheadend.git \
            file://0001-adjust-for-64bit-time_t.patch \
+           file://0001-allocate-space-for-buf-on-heap.patch \
            "
 
 SRCREV = "fda89e85e0b6ae796d8a09e178d3937aa7869270"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list