[PATCH 1/2] qmi-firmware-update: fix seg fault in case of error in hdlc_unframe

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


---
 src/qmi-firmware-update/qfu-qdl-device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qmi-firmware-update/qfu-qdl-device.c b/src/qmi-firmware-update/qfu-qdl-device.c
index d045ad9..d5252c1 100644
--- a/src/qmi-firmware-update/qfu-qdl-device.c
+++ b/src/qmi-firmware-update/qfu-qdl-device.c
@@ -413,7 +413,7 @@ receive_response (QfuQdlDevice  *self,
     unframed_size = hdlc_unframe (self->priv->buffer->data, frame_size, self->priv->secondary_buffer->data, self->priv->secondary_buffer->len, error);
     if (unframed_size == 0) {
         g_prefix_error (error, "error unframing message: ");
-        return FALSE;
+        return -1;
     }
 
     /* Debug output */
@@ -490,7 +490,7 @@ qfu_qdl_device_ufopen (QfuQdlDevice  *self,
         return FALSE;
 
     rsplen = send_receive (self, self->priv->buffer->data, reqlen, TRUE, 1, &rsp, cancellable, error);
-    if (rsplen < 0)
+    if (rsplen <= 0)
         return FALSE;
 
     switch (rsp[0]) {
-- 
2.11.0



More information about the libqmi-devel mailing list