diff --git a/Romulus-M/encrypt_wrapper.c b/Romulus-M/encrypt_wrapper.c index 0737e4a..ffff5f3 100644 --- a/Romulus-M/encrypt_wrapper.c +++ b/Romulus-M/encrypt_wrapper.c @@ -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;