From: Jaroslav Kysela Date: Fri, 18 Mar 2016 15:09:57 +0000 (+0100) Subject: IPTV: udp:// - don't allow to receive non-raw UDP data, fixes #2470 X-Git-Tag: v4.2.1~838 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc32a92f818dfabcbc10b2da04af65067511ecbc;p=thirdparty%2Ftvheadend.git IPTV: udp:// - don't allow to receive non-raw UDP data, fixes #2470 --- diff --git a/src/input/mpegts/iptv/iptv_udp.c b/src/input/mpegts/iptv/iptv_udp.c index a264cda72..25c851579 100644 --- a/src/input/mpegts/iptv/iptv_udp.c +++ b/src/input/mpegts/iptv/iptv_udp.c @@ -79,16 +79,30 @@ iptv_udp_read ( iptv_mux_t *im ) struct iovec *iovec; udp_multirecv_t *um = im->im_data; ssize_t res = 0; + char name[256]; n = udp_multirecv_read(um, im->mm_iptv_fd, IPTV_PKTS, &iovec); if (n < 0) return -1; + im->mm_iptv_rtp_seq &= ~0xfff; for (i = 0; i < n; i++, iovec++) { + if (iovec->iov_len <= 0) + continue; + if (*(uint8_t *)iovec->iov_base != 0x47) { + im->mm_iptv_rtp_seq++; + continue; + } sbuf_append(&im->mm_iptv_buffer, iovec->iov_base, iovec->iov_len); res += iovec->iov_len; } + if (im->mm_iptv_rtp_seq < 0xffff && im->mm_iptv_rtp_seq > 0x3ff) { + mpegts_mux_nice_name((mpegts_mux_t*)im, name, sizeof(name)); + tvherror("iptv", "receving non-raw UDP data for %s!", name); + im->mm_iptv_rtp_seq = 0x10000; /* no further logs! */ + } + return res; }