Change the lenght value, not the address of the pointer to the length value
authorNathael Pajani <nathael.pajani@ed3l.fr>
Sat, 16 Mar 2019 16:30:52 +0000 (17:30 +0100)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 8 Nov 2022 16:03:05 +0000 (17:03 +0100)
lib/protocols/mqtt.c

index 6a6cef7..cec954c 100644 (file)
@@ -78,7 +78,7 @@ static int decode_remaining_length(uint8_t* buf, uint32_t* length)
        int idx = 0;
 
        do {
-               length += (buf[idx] & 0x7F) << (7 * idx);
+               *length += (buf[idx] & 0x7F) << (7 * idx);
        } while ((buf[idx++] & 0x80) && (idx <= 3));
 
        return idx;