Commit 03c60063 authored by Italo Guerrieri's avatar Italo Guerrieri Committed by Ignacio Casal Quinteiro
Browse files

Fix invalid UTF8 close payload

Close the connection with a protocol error if the close payload
is an invalid utf8.
Fix Autobahn test case 7.5.1.

https://bugzilla.gnome.org/show_bug.cgi?id=792113
parent 5dec678b
......@@ -611,10 +611,14 @@ receive_close (SoupWebsocketConnection *self,
if (len > 2) {
data += 2;
len -= 2;
if (g_utf8_validate ((char *)data, len, NULL))
pv->peer_close_data = g_strndup ((char *)data, len);
else
if (!g_utf8_validate ((char *)data, len, NULL)) {
g_debug ("received non-UTF8 close data: %d '%.*s' %d", (int)len, (int)len, (char *)data, (int)data[0]);
protocol_error_and_close (self);
return;
}
pv->peer_close_data = g_strndup ((char *)data, len);
}
/* Once we receive close response on server, close immediately */
......
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