Yubico / yubikey-personalization

YubiKey Personalization cross-platform library and tool
https://developers.yubico.com/yubikey-personalization/
BSD 2-Clause "Simplified" License
299 stars 82 forks source link

Gil Kloepfer suggests this quick strlen fix for returning serial_modhex in ykinfo.c #113

Closed rgtx closed 6 years ago

rgtx commented 6 years ago

For these sample device serial number values, strlen() is hitting the null at the end of serial_hex and returning an incorrect length:

serial: 7123200 serial_hex: 6cb100 serial_modhex: hrnb ["cc" is truncated here]

strlen(ptr)/2 returns the correct length, regardless of content.

serial: 7123200 serial_hex: 6cb100 serial_modhex: hrnbcc

Credit to Gil Kloepfer for the fix.

klali commented 6 years ago

Yes, this looks like a proper quick-fix for this issue, merging.

Thanks!