nts: check for negative length in NNA_DecryptAuthEF()

As other functions that accept a signed length, make sure it is sane in
NNA_DecryptAuthEF() too.
This commit is contained in:
Miroslav Lichvar
2020-07-09 13:13:13 +02:00
parent 72ee80debe
commit db54bfc0c1
2 changed files with 7 additions and 0 deletions

View File

@@ -82,6 +82,10 @@ test_unit(void)
TEST_CHECK(r);
TEST_CHECK(info.length - packet_length >= min_ef_length);
r = NNA_DecryptAuthEF(&packet, &info, siv, packet_length, plaintext2,
-1, &plaintext2_length);
TEST_CHECK(!r);
r = NNA_DecryptAuthEF(&packet, &info, siv, packet_length, plaintext2,
sizeof (plaintext2), &plaintext2_length);
TEST_CHECK(r);