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:
Jakub Jelen
2026-01-08 12:09:50 +01:00
parent a411de5ce8
commit 417a095e67

View File

@@ -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;
}