diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-10-01 06:06:01 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-10-01 06:06:01 +0000 |
commit | 6c518ed08a6e2e053996bef7601548e70e936016 (patch) | |
tree | ab54a51c0fe72a908cc9ab82f01a1dbb76850cbd | |
parent | 0c1cee67db5ce5bcf02c6983f397c03da0346741 (diff) |
Ticket #960: STUN compatibility problem with RFC 3489 servers (in encoding SERVER-NAME or SOFTWARE attribute)
- now always set string attribute's length to 4-bytes aligned
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2916 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjnath/src/pjnath/stun_msg.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pjnath/src/pjnath/stun_msg.c b/pjnath/src/pjnath/stun_msg.c index 7cc4d24d..fb9f1cb9 100644 --- a/pjnath/src/pjnath/stun_msg.c +++ b/pjnath/src/pjnath/stun_msg.c @@ -1234,8 +1234,11 @@ static pj_status_t encode_string_attr(const void *a, pj_uint8_t *buf, } PUTVAL16H(buf, 0, ca->hdr.type); - PUTVAL16H(buf, 2, (pj_uint16_t)ca->value.slen); - + + /* Set the length to be 4-bytes aligned so that we can + * communicate with RFC 3489 endpoints + */ + PUTVAL16H(buf, 2, (pj_uint16_t)((ca->value.slen + 3) & (~3))); /* Copy the string */ pj_memcpy(buf+ATTR_HDR_LEN, ca->value.ptr, ca->value.slen); |