Commit aa772b0b authored by Dafydd Harries's avatar Dafydd Harries
Browse files

stun: don't include message header size in packed length

darcs-hash:20061220200459-c9803-c88efb120656f7cf5870e91cf80ceb9622088da5.gz
parent 83407e22
......@@ -174,7 +174,7 @@ stun_message_pack(StunMessage *msg, gchar **packed)
GString *tmp = g_string_new("");
unsigned int packed_type;
guint16 packed_length;
guint length = 20;
guint length = 0;
if (msg->attributes) {
StunAttribute **attr;
......@@ -205,7 +205,7 @@ stun_message_pack(StunMessage *msg, gchar **packed)
}
*packed = g_string_free(tmp, FALSE);
return length;
return length + 20;
}
gchar *
......
......@@ -90,7 +90,7 @@ START_TEST (test_message_pack)
fail_unless(packed != NULL);
fail_unless(length == 32);
fail_unless(0 == memcmp(packed + 0, "\x00\x01", 2));
fail_unless(0 == memcmp(packed + 2, "\x00\x20", 2));
fail_unless(0 == memcmp(packed + 2, "\x00\x0c", 2));
fail_unless(0 == memcmp(packed + 4,
"\x00\x01\x02\x03"
"\x04\x05\x06\x07"
......
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