mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-12 22:59:38 +02:00
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:
@@ -700,7 +700,7 @@ func parseFieldDataLength(data []byte) (uint16, error) {
|
||||
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)
|
||||
|
Reference in New Issue
Block a user