[gtk+] Fix uninitialized digest_len field, causing WebSocket handshake to g_assert.
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Fix uninitialized digest_len field, causing WebSocket handshake to g_assert.
- Date: Mon, 14 Nov 2011 08:55:30 +0000 (UTC)
commit 981efc90b41d52f9785bbff66a94ec71a9174940
Author: C. Scott Ananian <cscott cscott net>
Date: Fri Nov 11 16:26:12 2011 -0500
Fix uninitialized digest_len field, causing WebSocket handshake to g_assert.
g_checksum_get_digest checks to ensure that the passed digest_len is long
enough to hold the digest, before setting it to the actual length of the
digest returned. Digest_len is uninitialized in the code, so if you're
lucky it will be larger than 20 and everything will work fine. If you're
unlucky, g_checksum_get_digest will return either -1 or some number less
than 20, and the g_assert(digest_len==20) will fail.
gdk/broadway/gdkdisplay-broadway.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 87fc1c8..5c711b7 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -660,8 +660,8 @@ send_error (HttpRequest *request,
static gchar *
generate_handshake_response_wsietf_v7 (const gchar *key)
{
- guchar digest[20];
- gsize digest_len;
+ gsize digest_len = 20;
+ guchar digest[digest_len];
GChecksum *checksum;
checksum = g_checksum_new (G_CHECKSUM_SHA1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]