From 71c6fa79f77a5475d03e276ddd782decf1f00fa4 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 29 Mar 2010 16:42:53 -0700 Subject: qcdm: fix CRC checking on some packets Should be pointing to the CRC location in the *unescaped* packet buffer since the CRC is subject to escaping/unescaping. Previous code pointed to the wrong location in the escaped packet buffer, which was often pointing to the write place if there weren't many escaped bytes in the input buffer, but was still wrong. --- libqcdm/src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libqcdm/src') diff --git a/libqcdm/src/utils.c b/libqcdm/src/utils.c index ab281557..9b9ac5f0 100644 --- a/libqcdm/src/utils.c +++ b/libqcdm/src/utils.c @@ -296,7 +296,7 @@ dm_decapsulate_buffer (const char *inbuf, /* Check the CRC of the packet's data */ crc = crc16 (outbuf, unesc_len - 2); - pkt_crc = *((guint16 *) &outbuf[pkt_len - 2]); + pkt_crc = *((guint16 *) &outbuf[unesc_len - 2]); if (crc != GUINT_FROM_LE (pkt_crc)) { *out_used = pkt_len + 1; /* packet + CRC + 0x7E */ return FALSE; -- cgit v1.2.3-70-g09d2