libsec: mark DigestState as stack var in ccpoly_*

CID 160099 and CID 160100 (#1 of 1): Free of address-of expression (BAD_FREE)
address_free: ccpolylen frees address of ds
This commit is contained in:
Giacomo Tesio 2017-01-17 20:30:01 +01:00
parent 3cfe366cc0
commit 663b002529
1 changed files with 2 additions and 0 deletions

View File

@ -50,6 +50,7 @@ ccpoly_encrypt(uint8_t *dat, uint32_t ndat, uint8_t *aad, uint32_t naad, uint8_t
DigestState ds;
ccpolyotk(cs, &ds);
ds.malloced = 0;
if(cs->ivwords == 2){
poly1305(aad, naad, nil, 0, nil, &ds);
ccpolylen(naad, nil, &ds);
@ -72,6 +73,7 @@ ccpoly_decrypt(uint8_t *dat, uint32_t ndat, uint8_t *aad, uint32_t naad, uint8_t
uint8_t tmp[16];
ccpolyotk(cs, &ds);
ds.malloced = 0;
if(cs->ivwords == 2){
poly1305(aad, naad, nil, 0, nil, &ds);
ccpolylen(naad, nil, &ds);