Commit 3826dec8 authored by Dafydd Harries's avatar Dafydd Harries

use calculated length to preallocate GString when packing STUN message

parent e4b671de
......@@ -224,7 +224,7 @@ stun_message_unpack (guint length, gchar *s)
stun_message_pack (StunMessage *msg, gchar **packed)
GString *tmp = g_string_new ("");
GString *tmp;
unsigned int packed_type;
guint16 packed_length;
guint length = 0;
......@@ -240,6 +240,7 @@ stun_message_pack (StunMessage *msg, gchar **packed)
packed_type = htons (msg->type);
packed_length = htons (length);
tmp = g_string_sized_new (length + 20);
g_string_append_printf (tmp, "%c%c%c%c",
((gchar *) &packed_type)[0],
((gchar *) &packed_type)[1],
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