[tracker/functions] libtracker-db: Check that journal entry size is big enough



commit 195200567bc921be5604ceb22b5e98dce23758e3
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jan 12 18:20:36 2010 +0100

    libtracker-db: Check that journal entry size is big enough

 src/libtracker-db/tracker-db-journal.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-journal.c b/src/libtracker-db/tracker-db-journal.c
index f6ea9a9..a594c33 100644
--- a/src/libtracker-db/tracker-db-journal.c
+++ b/src/libtracker-db/tracker-db-journal.c
@@ -694,6 +694,14 @@ tracker_db_journal_reader_next (GError **error)
 		/* Read the first uint32 which contains the size */
 		entry_size = read_uint32 (reader.current);
 
+		/* Check that entry is big enough for header and footer */
+		if (entry_size < 5 * sizeof (guint32)) {
+			g_set_error (error, TRACKER_DB_JOURNAL_ERROR, 0,
+			             "Damaged journal entry, size %d < 5 * sizeof(guint32)",
+			             (gint) entry_size);
+			return FALSE;
+		}
+
 		/* Set the bounds for the entry */
 		reader.entry_begin = reader.current;
 		reader.entry_end = reader.entry_begin + entry_size;



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