From ac3599bc797ac914e02aa4bb600db9b667e2ce31 Mon Sep 17 00:00:00 2001 From: Mariusz Bialonczyk Date: Fri, 13 Mar 2015 13:16:53 +0100 Subject: [PATCH] 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. --- src/descrambler/capmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/descrambler/capmt.c b/src/descrambler/capmt.c index 818ef7a5..b850dc14 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);