From c3d1fd0ff86f3e1c372fa2da5caf8f74eadd9787 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Mon, 12 Mar 2018 16:35:36 -0700 Subject: [PATCH] sp-capture-writer: Initialize write buffer Valgrind notes that the buffer is not fully initialized when we pass it to write(). This could potentially write sensitive data, if we are not careful with the buffer length. See https://gitlab.gnome.org/GNOME/gjs/issues/120 https://bugzilla.gnome.org/show_bug.cgi?id=794272 --- lib/capture/sp-capture-writer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/capture/sp-capture-writer.c b/lib/capture/sp-capture-writer.c index 9b4603f1..610e22f4 100644 --- a/lib/capture/sp-capture-writer.c +++ b/lib/capture/sp-capture-writer.c @@ -425,7 +425,7 @@ sp_capture_writer_new_from_fd (int fd, self = g_new0 (SpCaptureWriter, 1); self->ref_count = 1; self->fd = fd; - self->buf = (guint8 *)g_malloc (buffer_size); + self->buf = (guint8 *)g_malloc0 (buffer_size); self->len = buffer_size; self->next_counter_id = 1;