Repository navigation
Commit f17fd71
committed
smart_battery: Reject non-hex characters in the auth key
The length check counts bytes, so a 32 byte key containing a multi-byte
UTF-8 character could make the two character slices split a character
and panic. u8::from_str_radix also accepts a leading '+', so "+a" was
silently taken as 0x0A. Check that every character is a hex digit
before parsing.1 parent d984fd7 commit f17fd71
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
977 | 982 | | |
978 | 983 | | |
979 | 984 | | |
| |||
0 commit comments