From: Mariusz Bialonczyk Date: Fri, 13 Mar 2015 12:16:53 +0000 (+0100) Subject: capmt: fix endless loop X-Git-Tag: v4.1~241 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ac3599bc797ac914e02aa4bb600db9b667e2ce31;p=thirdparty%2Ftvheadend.git capmt: fix endless loop When tvh receives less then 4 bytes from the socket for some reason, it stuck in the endless loop in handle_single() calling: capmt_msg_size() capmt_analyze_cmd() The capmt thread eats 100% CPU and cannot be normally terminated because the capmt_msg_size() was constantly returning 0. The commit fixes the problem. --- diff --git a/src/descrambler/capmt.c b/src/descrambler/capmt.c index 818ef7a5b..b850dc145 100644 --- a/src/descrambler/capmt.c +++ b/src/descrambler/capmt.c @@ -1372,7 +1372,7 @@ handle_single(capmt_t *capmt) } if (adapter < MAX_CA) { cmd_size = capmt_msg_size(capmt, &buffer, offset); - if (cmd_size >= 0) + if (cmd_size > 0) break; } sbuf_cut(&buffer, 1);