Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openpgp-tool: fix buffer overflow on serials with MSb set
Fixes the following crash: $ openpgp-tool --card-info Using reader with a card: Linux Foundation Multifunction Composite Gadget - vincent [python-usb-f-ccid] 00 00 AID: d2:76:00:01:24:01:03:41:ff:65:a4:9b:68:64:00:00 Version: 3.41 Manufacturer: unmanaged S/N range *** buffer overflow detected ***: terminated Abandon (core dumped) "a4:9b:68:64" from the AID being the serial, and: (gdb) print (data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]) $12 = -1533319068 but (gdb) print (unsigned long) (data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]) $13 = 18446744072176232548 Avoid the shifts and cast altogether.
- Loading branch information