Changeset 1150 for pjproject/trunk/pjnath/src/pjnath/stun_msg.c
- Timestamp:
- Apr 4, 2007 5:29:36 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/stun_msg.c
r1141 r1150 233 233 }, 234 234 { 235 /* ID 0x000F is not assigned*/236 NULL,237 NULL,238 NULL235 /* PJ_STUN_ATTR_MAGIC_COOKIE */ 236 "MAGIC-COOKIE", 237 &decode_uint_attr, 238 &encode_uint_attr 239 239 }, 240 240 { … … 1773 1773 /* Parse attributes */ 1774 1774 uattr_cnt = 0; 1775 while (pdu_len > 0) {1775 while (pdu_len >= 4) { 1776 1776 unsigned attr_type, attr_val_len; 1777 1777 const struct attr_desc *adesc; … … 1780 1780 * to 4 bytes boundary, add padding. 1781 1781 */ 1782 attr_type = pj_ntohs(*(pj_uint16_t*)pdu);1783 attr_val_len = pj_ntohs(*(pj_uint16_t*)(pdu+2));1782 attr_type = GETVAL16H(pdu, 0); 1783 attr_val_len = GETVAL16H(pdu, 2); 1784 1784 attr_val_len = (attr_val_len + 3) & (~3); 1785 1785 … … 1920 1920 } 1921 1921 1922 pdu += (attr_val_len + 4); 1923 pdu_len -= (attr_val_len + 4); 1922 if (attr_val_len + 4 >= pdu_len) { 1923 pdu += pdu_len; 1924 pdu_len = 0; 1925 } else { 1926 pdu += (attr_val_len + 4); 1927 pdu_len -= (attr_val_len + 4); 1928 } 1929 } 1930 1931 if (pdu_len > 0) { 1932 /* Stray trailing bytes */ 1933 PJ_LOG(4,(THIS_FILE, 1934 "Error decoding STUN message: unparsed trailing %d bytes", 1935 pdu_len)); 1936 return PJNATH_EINSTUNMSGLEN; 1924 1937 } 1925 1938
Note: See TracChangeset
for help on using the changeset viewer.