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>
(cherry picked from commit 417a095e67)
This commit is contained in:
@@ -459,7 +459,7 @@ char *ssh_get_hexa(const unsigned char *what, size_t len)
|
|||||||
size_t i;
|
size_t i;
|
||||||
size_t hlen = len * 3;
|
size_t hlen = len * 3;
|
||||||
|
|
||||||
if (len > (UINT_MAX - 1) / 3) {
|
if (what == NULL || len < 1 || len > (UINT_MAX - 1) / 3) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user