From: beralt Date: Sat, 4 Jun 2016 06:22:14 +0000 (+0200) Subject: tvhdhomerun: warn user when pid is too large, and restrict pid to maximum X-Git-Tag: v4.2.1~438 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e371eb07f0f58f5b548d75533cd226a475edea7d;p=thirdparty%2Ftvheadend.git tvhdhomerun: warn user when pid is too large, and restrict pid to maximum --- diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c index 28ceeeb18..c6ad64c86 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c @@ -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);