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.
This commit is contained in:
Dan Williams
2010-03-29 16:42:53 -07:00
parent 2f099e2964
commit 71c6fa79f7
5 changed files with 92 additions and 1 deletions

View File

@@ -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;