]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
tvhdhomerun: warn user when pid is too large, and restrict pid to maximum
authorberalt <beralt@beralt.nl>
Sat, 4 Jun 2016 06:22:14 +0000 (08:22 +0200)
committerJaroslav Kysela <perex@perex.cz>
Sat, 4 Jun 2016 08:47:10 +0000 (10:47 +0200)
src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c

index 28ceeeb180735378f91f06ab5ed39e70a2207b36..c6ad64c86aea8b668f441b98f60bec5b57665a81 100644 (file)
@@ -331,7 +331,10 @@ static void tvhdhomerun_device_open_pid(tvhdhomerun_frontend_t *hfe, int pid) {
   tvhdebug("tvhdhomerun", "current pfilter: %s", pfilter);
 
   /* make sure the pid maps to a max of 0x1FFF, API will reject the call otherwise */
-  pid = (pid & 0x1FFF);
+  if(pid > 0x1FFF) {
+    tvhlog(LOG_ERR, "tvhdhomerun", "pid %d is too large, masking to API maximum of 0x1FFF", pid);
+    pid = (pid & 0x1FFF);
+  }
 
   memset(buf, 0x00, sizeof(buf));
   snprintf(buf, sizeof(buf), "0x%04x", pid);