mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Remove some spurious null pointer tests.
In load_openssh_new_key, ret->keyblob is never null any more: now that it's a strbuf instead of a bare realloc()ed string, it's at worst an _empty_ strbuf. Secondly, as Coverity pointed out, the null pointer check was too late to do any good in the first place - the previous clause of the same if condition would already have dereferenced it! In test_mac in the auxiliary testsc program, there's no actual reason I would ever have called it with null ssh_mac pointer - it would mean 'don't test anything'! Looks as if I just copy-pasted the MAC parts of the cipher+MAC setup code in test_cipher.
This commit is contained in:
parent
64fdc85b2d
commit
0f6ce9bd01
2
import.c
2
import.c
@ -1166,7 +1166,7 @@ static struct openssh_new_key *load_openssh_new_key(const Filename *filename,
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
|
||||||
if (ret->keyblob->len == 0 || !ret->keyblob) {
|
if (ret->keyblob->len == 0) {
|
||||||
errmsg = "key body not present";
|
errmsg = "key body not present";
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
4
testsc.c
4
testsc.c
@ -1303,9 +1303,9 @@ static void test_mac(const ssh2_macalg *malg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *mkey = malg ? snewn(malg->keylen, uint8_t) : NULL;
|
uint8_t *mkey = snewn(malg->keylen, uint8_t);
|
||||||
size_t datalen = 256;
|
size_t datalen = 256;
|
||||||
size_t maclen = malg ? malg->len : 0;
|
size_t maclen = malg->len;
|
||||||
uint8_t *data = snewn(datalen + maclen, uint8_t);
|
uint8_t *data = snewn(datalen + maclen, uint8_t);
|
||||||
|
|
||||||
/* Preliminarily key the MAC, to avoid the divergence of control
|
/* Preliminarily key the MAC, to avoid the divergence of control
|
||||||
|
Loading…
Reference in New Issue
Block a user