aboutsummaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-sub-ui.c
diff options
context:
space:
mode:
authorMikulas Patocka <[email protected]>2022-04-27 11:26:40 -0400
committerLinus Torvalds <[email protected]>2022-04-27 10:57:33 -0700
commite4d8a29997731b3bb14059024b24df9f784288d0 (patch)
treef00d3677b90779d9ff1a41bb401e8c9f40c69d1c /lib/mpi/mpi-sub-ui.c
parente5be15767e7e284351853cbaba80cde8620341fb (diff)
hex2bin: fix access beyond string end
If we pass too short string to "hex2bin" (and the string size without the terminating NUL character is even), "hex2bin" reads one byte after the terminating NUL character. This patch fixes it. Note that hex_to_bin returns -1 on error and hex2bin return -EINVAL on error - so we can't just return the variable "hi" or "lo" on error. This inconsistency may be fixed in the next merge window, but for the purpose of fixing this bug, we just preserve the existing behavior and return -1 and -EINVAL. Signed-off-by: Mikulas Patocka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Fixes: b78049831ffe ("lib: add error checking to hex2bin") Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions