[libgdata] [core] Fix potential use of NULL in memcpy()



commit 1afdab0f3d6adbd7ebbbf3bd7248651a924e6b68
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 dc0ab83..18f1395 100644
--- a/gdata/gdata-buffer.c
+++ b/gdata/gdata-buffer.c
@@ -135,7 +135,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]