Show
Ignore:
Timestamp:
06/15/08 21:40:33 (2 months ago)
Author:
Rémi Denis-Courmont <rdenis@simphalempin.com>
git-committer:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1213558833 +0300
git-parent:

[74e39ff5c2338562f55aba264ac70ed7f1b43e85]

git-author:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1213558833 +0300
Message:

SRTP: check buffer length before sequence

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libs/srtp/srtp.c

    r8650df1 rbc3af7e  
    601601{ 
    602602    size_t len = *lenp; 
     603    size_t tag_len = s->tag_len; 
     604 
     605    if (!(s->flags & SRTP_UNAUTHENTICATED)) 
     606    { 
     607        *lenp = len + tag_len; 
     608        if (bufsize < (len + tag_len)) 
     609            return ENOSPC; 
     610    } 
     611 
    603612    int val = srtp_crypt (s, buf, len); 
    604613    if (val) 
     
    607616    if (!(s->flags & SRTP_UNAUTHENTICATED)) 
    608617    { 
    609         size_t tag_len = s->tag_len; 
    610         *lenp = len + tag_len; 
    611         if (bufsize < (len + tag_len)) 
    612             return ENOSPC; 
    613  
    614618        uint32_t roc = srtp_compute_roc (s, rtp_seq (buf)); 
    615619        const uint8_t *tag = rtp_digest (s, buf, len, roc);