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:
Jakub Jelen
2026-01-08 12:09:50 +01:00
parent 6d74aa6138
commit 6ba5ff1b7b

View File

@@ -459,7 +459,7 @@ char *ssh_get_hexa(const unsigned char *what, size_t len)
size_t i;
size_t hlen = len * 3;
if (len > (UINT_MAX - 1) / 3) {
if (what == NULL || len < 1 || len > (UINT_MAX - 1) / 3) {
return NULL;
}