]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvbpsi: fix the dvb_desc_service() fcn - stack corruption (clang sanitizer)
authorJaroslav Kysela <perex@perex.cz>
Fri, 17 Jun 2016 20:09:01 +0000 (22:09 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 17 Jun 2016 20:09:07 +0000 (22:09 +0200)
Makefile
src/input/mpegts/dvb_psi.c

index b0aec405d93270450aa0d156d1451bdd88b82577..6bca28e48f53884468e4ac6ec2e0d1f69c04a00d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ LANGUAGES ?= bg cs da de en_US en_GB es et fa fi fr he hr hu it lv nl pl pt ru s
 # Common compiler flags
 #
 
-CFLAGS  += -g -O2 -fPIE
+CFLAGS  += -g -O0 -fPIE
 ifeq ($(CONFIG_PIE),yes)
 CFLAGS  += -fPIE
 else
index 5063ffe4cae417e00096b22d5fffd4bcd264096f..28b1ecd42f0680688cd98c11cd691d6368bc4d36 100644 (file)
@@ -418,14 +418,13 @@ dvb_desc_service
 
   /* Cleanup name */
   str = sname;
-  while (*str && *str <= 32)
+  while (*str && *str <= ' ')
     str++;
-  memmove(sname, str, sname_len); // Note: could avoid this copy by passing an output ptr
-  l   = strlen(str);
-  while (l > 1 && str[l-1] <= 32) {
-    str[l-1] = 0;
-    l--;
-  }
+  if (str != sname)
+    memmove(sname, str, sname_len - (str - sname));
+  l = strlen(str);
+  while (l > 1 && str[l-1] <= ' ')
+    str[--l] = '\0';
 
   return 0;
 }