Add check for packets missing a nonce

This commit is contained in:
Simon 2022-02-02 23:12:08 +00:00
parent c7375ad44b
commit 1a45c11dfb
1 changed files with 5 additions and 0 deletions

View File

@ -125,6 +125,11 @@ int decrypt(packetEx *packet, unsigned char *inBuf, UINT16 len, unsigned char *k
// n = nonce, CRYPTO_NPUBBYTES size 16
unsigned char *npub = &inBuf[loc];
loc += CRYPTO_NPUBBYTES;
if ((len - loc) < 0 )
{
return 1;
}
// ciphertext - in, MAX 16 bytes larger than plaintext - defined as CRYPTO_ABYTES
int clen = len - loc;