Changeset 572
- Timestamp:
- Jul 2, 2006 1:36:50 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/sdp.c
r571 r572 102 102 103 103 if (value) 104 pj_strdup (pool, &attr->value, value);104 pj_strdup_with_null(pool, &attr->value, value); 105 105 else { 106 106 attr->value.ptr = NULL; … … 121 121 122 122 pj_strdup(pool, &attr->name, &rhs->name); 123 pj_strdup (pool, &attr->value, &rhs->value);123 pj_strdup_with_null(pool, &attr->value, &rhs->value); 124 124 125 125 return attr; … … 250 250 pj_str_t token; 251 251 pj_status_t status = -1; 252 char term = 0; 252 253 PJ_USE_EXCEPTION; 253 254 254 255 PJ_ASSERT_RETURN(pj_strcmp2(&attr->name, "rtpmap")==0, PJ_EINVALIDOP); 256 257 PJ_ASSERT_RETURN(attr->value.slen != 0, PJMEDIA_SDP_EINATTR); 258 259 /* Check if input is null terminated, and null terminate if 260 * necessary. Unfortunately this may crash the application if 261 * attribute was allocated from a read-only memory location. 262 * But this shouldn't happen as attribute's value normally is 263 * null terminated. 264 */ 265 if (attr->value.ptr[attr->value.slen] != 0 && 266 attr->value.ptr[attr->value.slen] != '\r') 267 { 268 pj_assert(!"Shouldn't happen"); 269 term = attr->value.ptr[attr->value.slen]; 270 attr->value.ptr[attr->value.slen] = '\0'; 271 } 255 272 256 273 pj_scan_init(&scanner, (char*)attr->value.ptr, attr->value.slen, … … 311 328 on_return: 312 329 pj_scan_fini(&scanner); 330 if (term) { 331 attr->value.ptr[attr->value.slen] = term; 332 } 313 333 return status; 314 334 }
Note: See TracChangeset
for help on using the changeset viewer.