[gjs: 2/7] sysprof: Initialize buffer in SpCaptureWriter



commit 500bfde1dd6320d12f9ea24542a91f0f720a5df0
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Mar 12 16:27:00 2018 -0700

    sysprof: Initialize buffer in SpCaptureWriter
    
    Valgrind notes that the buffer is not fully initialized when passed to
    write(). This could potentially write sensitive data, if we are not
    careful with the buffer length.
    
    Reported upstream: https://bugzilla.gnome.org/show_bug.cgi?id=794272
    
    See #120.

 util/sp-capture-writer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/util/sp-capture-writer.c b/util/sp-capture-writer.c
index 3299db8..5dc4997 100644
--- a/util/sp-capture-writer.c
+++ b/util/sp-capture-writer.c
@@ -432,7 +432,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]