aboutsummaryrefslogtreecommitdiff
path: root/libqcdm/src/utils.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-03-29 16:42:53 -0700
committerDan Williams <dcbw@redhat.com>2010-03-29 16:42:53 -0700
commit71c6fa79f77a5475d03e276ddd782decf1f00fa4 (patch)
tree633c5ac4f72271fc7c8ae6747a39108ce4ad7c1c /libqcdm/src/utils.c
parent2f099e2964040e5499f332a892352f148f5b0177 (diff)
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.
Diffstat (limited to 'libqcdm/src/utils.c')
-rw-r--r--libqcdm/src/utils.c2
1 files changed, 1 insertions, 1 deletions
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;