libsec: fix out of bound write (CID 155904)
In aesXCBCmac fix (potential) out of bound write in padding. CID 155904 (#1 of 1): Out-of-bounds write (OVERRUN) 7. overrun-local: Overrunning array of 16 bytes at byte offset 16 by dereferencing pointer p2++.
This commit is contained in:
parent
06376d5859
commit
3cfe366cc0
|
@ -142,12 +142,12 @@ aesXCBCmac(uint8_t *p, int len, AESstate *s)
|
|||
/* the last one */
|
||||
|
||||
memmove(q, p, len);
|
||||
p2 = q+len;
|
||||
if(len == AESbsize)
|
||||
mackey = s->mackey + AESbsize; /* k2 */
|
||||
else{
|
||||
mackey = s->mackey+2*AESbsize; /* k3 */
|
||||
*p2++ = 1 << 7; /* padding */
|
||||
p2 = q+len; /* padding */
|
||||
*p2++ = 1 << 7;
|
||||
len = AESbsize - len - 1;
|
||||
memset(p2, 0, len);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue