Add check for packets missing a nonce
This commit is contained in:
parent
c7375ad44b
commit
1a45c11dfb
|
@ -125,6 +125,11 @@ int decrypt(packetEx *packet, unsigned char *inBuf, UINT16 len, unsigned char *k
|
||||||
// n = nonce, CRYPTO_NPUBBYTES size 16
|
// n = nonce, CRYPTO_NPUBBYTES size 16
|
||||||
unsigned char *npub = &inBuf[loc];
|
unsigned char *npub = &inBuf[loc];
|
||||||
loc += CRYPTO_NPUBBYTES;
|
loc += CRYPTO_NPUBBYTES;
|
||||||
|
|
||||||
|
if ((len - loc) < 0 )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// ciphertext - in, MAX 16 bytes larger than plaintext - defined as CRYPTO_ABYTES
|
// ciphertext - in, MAX 16 bytes larger than plaintext - defined as CRYPTO_ABYTES
|
||||||
int clen = len - loc;
|
int clen = len - loc;
|
||||||
|
|
Loading…
Reference in New Issue