Commit 79fa3296 authored by Dafydd Harries's avatar Dafydd Harries
Browse files

stun_message_unpack: include attribute header in header length

darcs-hash:20070126083105-c9803-58155f9ecca179512d945089de8447426cd76477.gz
parent 5b3c4134
......@@ -165,9 +165,9 @@ stun_message_unpack (guint length, gchar *s)
/* count the number of attributes */
for (offset = 20; offset < length; offset += attr_length + 4)
for (offset = 20; offset < length; offset += attr_length)
{
attr_length = ntohs (*(guint16 *)(s + offset + 2));
attr_length = 4 + ntohs (*(guint16 *)(s + offset + 2));
n_attributes++;
}
......@@ -178,9 +178,9 @@ stun_message_unpack (guint length, gchar *s)
/* unpack attributes */
for (i = 0, offset = 20; i < n_attributes; i++, offset += attr_length + 4)
for (i = 0, offset = 20; i < n_attributes; i++, offset += attr_length)
{
attr_length = ntohs (*(guint16 *)(s + offset + 2));
attr_length = 4 + ntohs (*(guint16 *)(s + offset + 2));
attr = msg->attributes[i] = stun_attribute_unpack (attr_length,
s + offset);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment