mirror of https://github.com/wolfSSL/wolfssh.git
F-4795 - Guard ClientPublicKeyCheck against short public key blob
parent
ea22e2962a
commit
aa7b268376
|
|
@ -392,11 +392,16 @@ int ClientPublicKeyCheck(const byte* pubKey, word32 pubKeySz, void* ctx)
|
|||
fp[0] = 0;
|
||||
|
||||
/* Get the key type out of the key. */
|
||||
ato32(pubKey, &sz);
|
||||
if ((sz > pubKeySz - sizeof(word32))
|
||||
|| (sz > WOLFSSH_CLIENT_PUBKEYTYPE_SIZE_ESTIMATE - 1)) {
|
||||
if (pubKeySz < sizeof(word32)) {
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
ato32(pubKey, &sz);
|
||||
if ((sz > pubKeySz - sizeof(word32))
|
||||
|| (sz > WOLFSSH_CLIENT_PUBKEYTYPE_SIZE_ESTIMATE - 1)) {
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue