Changeset 2794


Ignore:
Timestamp:
Jun 24, 2009 4:00:36 PM (11 years ago)
Author:
nanang
Message:

Ticket #903: backported changes from ticket #862

Location:
pjproject/branches/1.0
Files:
1 deleted
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.0

  • pjproject/branches/1.0/pjmedia/src/pjmedia/transport_srtp.c

    r2533 r2794  
    2323#include <pjlib-util/base64.h> 
    2424#include <pj/assert.h> 
     25#include <pj/ctype.h> 
    2526#include <pj/lock.h> 
    2627#include <pj/log.h> 
     
    980981    pj_str_t input; 
    981982    char *token; 
     983    int token_len; 
    982984    pj_str_t tmp; 
    983985    pj_status_t status; 
     
    993995        return PJMEDIA_SDP_EINATTR; 
    994996    } 
     997    token_len = pj_ansi_strlen(token); 
     998 
     999    /* Tag must not use leading zeroes. */ 
     1000    if (token_len > 1 && *token == '0') 
     1001        return PJMEDIA_SDP_EINATTR; 
     1002 
     1003    /* Tag must be decimal, i.e: contains only digit '0'-'9'. */ 
     1004    for (itmp = 0; itmp < token_len; ++itmp) 
     1005        if (!pj_isdigit(token[itmp])) 
     1006            return PJMEDIA_SDP_EINATTR; 
     1007 
     1008    /* Get tag value. */ 
    9951009    *tag = atoi(token); 
    996     if (*tag == 0) 
    997         return PJMEDIA_SDP_EINATTR; 
    9981010 
    9991011    /* Crypto-suite */ 
Note: See TracChangeset for help on using the changeset viewer.