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
This commit is contained in:
Philip Chimento
2018-03-12 16:35:36 -07:00
committed by Christian Hergert
parent 0b23643cbe
commit c3d1fd0ff8

View File

@ -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;