Ignore:
Timestamp:
Jun 2, 2010 9:32:42 AM (9 years ago)
Author:
nanang
Message:

Fix #1074: Fixed SRTP crypto parser to preverify the key length.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r2891 r3191  
    10551055    } 
    10561056    tmp = pj_str(token); 
     1057    if (PJ_BASE64_TO_BASE256_LEN(tmp.slen) > MAX_KEY_LEN) { 
     1058        PJ_LOG(4,(THIS_FILE, "Key too long")); 
     1059        return PJMEDIA_SRTP_EINKEYLEN; 
     1060    } 
     1061 
     1062    /* Decode key */ 
    10571063    crypto->key.ptr = (char*) pj_pool_zalloc(pool, MAX_KEY_LEN); 
    1058  
    1059     /* Decode key */ 
    10601064    itmp = MAX_KEY_LEN; 
    10611065    status = pj_base64_decode(&tmp, (pj_uint8_t*)crypto->key.ptr,  
Note: See TracChangeset for help on using the changeset viewer.