bignum: Make sure the padding is large enough for the number

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
Jakub Jelen
2025-01-15 22:25:36 +01:00
parent 1ea9708409
commit 0cda1c0e83
3 changed files with 37 additions and 5 deletions

View File

@@ -40,7 +40,10 @@ static ssh_string make_bignum_string(bignum num, size_t pad_to_len)
pad++;
}
} else {
pad = pad_to_len - bignum_num_bytes(num);
if (len > pad_to_len) {
return NULL;
}
pad = pad_to_len - len;
}
#ifdef DEBUG_CRYPTO