[libgdata/libgdata-0-6] core: Fix potential use of NULL in memcpy()



commit e700f1a05e843eb112989678e9868b08b5524486
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Aug 7 19:21:45 2010 +0100

    core: Fix potential use of NULL in memcpy()

 gdata/gdata-buffer.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gdata/gdata-buffer.c b/gdata/gdata-buffer.c
index 2fbb48f..2e67a0d 100644
--- a/gdata/gdata-buffer.c
+++ b/gdata/gdata-buffer.c
@@ -131,7 +131,8 @@ gdata_buffer_push_data (GDataBuffer *self, const guint8 *data, gsize length)
 	chunk->next = NULL;
 
 	/* Copy the data to the chunk */
-	memcpy (chunk->data, data, length);
+	if (G_LIKELY (data != NULL))
+		memcpy (chunk->data, data, length);
 
 	/* Add it to the buffer's tail */
 	if (self->tail != NULL)



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