mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
CVE-2026-0966 misc: Avoid heap buffer underflow in ssh_get_hexa
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
This commit is contained in:
@@ -499,7 +499,7 @@ ssh_get_hexa_internal(const unsigned char *what, size_t len, bool colons)
|
||||
size_t bytes_per_byte = 2 + (colons ? 1 : 0);
|
||||
size_t hlen = len * bytes_per_byte;
|
||||
|
||||
if (len > (UINT_MAX - 1) / bytes_per_byte) {
|
||||
if (what == NULL || len < 1 || len > (UINT_MAX - 1) / bytes_per_byte) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user