invoice: properly parse the field data length
When accessing a value from a byte slice, the value is returned as a byte, which is just a uint8. When the first byte takes more than 3 bits of space, shifting 5 bits left results in data loss.
This commit is contained in:
1 file changed
+1
-1
+1
-1
@@ -700,7 +700,7 @@ func parseFieldDataLength(data []byte) (uint16, error) {
|
|||||||
len(data))
|
len(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
return uint16(data[0]<<5) | uint16(data[1]), nil
|
return uint16(data[0])<<5 | uint16(data[1]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parsePaymentHash converts a 256-bit payment hash (encoded in base32)
|
// parsePaymentHash converts a 256-bit payment hash (encoded in base32)
|
||||||
|
|||||||
Reference in new issue
Block a user