[sysprof] sp-capture-writer: Initialize write buffer



commit c3d1fd0ff86f3e1c372fa2da5caf8f74eadd9787
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Mar 12 16:35:36 2018 -0700

    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 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/lib/capture/sp-capture-writer.c b/lib/capture/sp-capture-writer.c
index 9b4603f..610e22f 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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]