[PATCH 2/2] qmi-firmware-update: fix CRC checking

Christophe Ronco c.ronco at kerlink.fr
Tue Jan 17 08:17:42 UTC 2017


CRC is not well checked if there is an escape char in input buffer.
---
 src/qmi-firmware-update/qfu-qdl-device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qmi-firmware-update/qfu-qdl-device.c b/src/qmi-firmware-update/qfu-qdl-device.c
index d5252c1..ad94afc 100644
--- a/src/qmi-firmware-update/qfu-qdl-device.c
+++ b/src/qmi-firmware-update/qfu-qdl-device.c
@@ -191,7 +191,7 @@ hdlc_unframe (const guint8 *in,
     j -= 2; /* remove the crc */
 
     /* verify the crc */
-    crc = qfu_utils_crc16 (in, j);
+    crc = qfu_utils_crc16 (out, j);
     if (crc != (out[j] | out[j + 1] << 8)) {
         g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
                      "crc check failed: 0x%04x != 0x%04x\n", crc, out[j] | out[j + 1] << 8);
-- 
2.11.0



More information about the libqmi-devel mailing list