Commit 14c33979 authored by Italo Guerrieri's avatar Italo Guerrieri Committed by Ignacio Casal Quinteiro
Browse files

Fix big control message payload

Close connection with protocol error if the payload of a
control message is bigger than 125 octets.
Fix Authobahn test case 2.5.

https://bugzilla.gnome.org/show_bug.cgi?id=792113
parent 17a682e3
......@@ -152,6 +152,8 @@ typedef enum {
static void queue_frame (SoupWebsocketConnection *self, SoupWebsocketQueueFlags flags,
gpointer data, gsize len, gsize amount);
static void protocol_error_and_close (SoupWebsocketConnection *self);
static void
frame_free (gpointer data)
{
......@@ -358,11 +360,12 @@ send_message (SoupWebsocketConnection *self,
outer = bytes->data;
outer[0] = 0x80 | opcode;
/* If control message, truncate payload */
/* If control message, check payload size */
if (opcode & 0x08) {
if (length > 125) {
g_warning ("Truncating WebSocket control message payload");
length = 125;
g_warning ("WebSocket control message payload exceeds size limit");
protocol_error_and_close (self);
return;
}
buffered_amount = 0;
......
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