bug-recutils
[Top][All Lists]
Advanced

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

[bug-recutils] [PATCH 07/13] src: fix index range checks.


From: Michał Masłowski
Subject: [bug-recutils] [PATCH 07/13] src: fix index range checks.
Date: Mon, 20 Aug 2012 18:21:28 +0200

---
 ChangeLog          | 6 ++++++
 src/rec-idx-file.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9de0115..2df5fca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2012-08-18  Michał Masłowski  <address@hidden>
 
+       src: fix index range checks.
+       * src/rec-idx-file.c (rec_idx_file_index): Check if the end of the
+       index is after the end of buffer, not after the start.
+
+2012-08-18  Michał Masłowski  <address@hidden>
+
        utils,doc: make recfix --build-index add index trees.
 
        * utils/recfix.c (recfix_do_build_index): Add indexes from %key or
diff --git a/src/rec-idx-file.c b/src/rec-idx-file.c
index 1713d2c..d519260 100644
--- a/src/rec-idx-file.c
+++ b/src/rec-idx-file.c
@@ -308,12 +308,12 @@ rec_idx_file_index (rec_idx_file_t idx_file,
       current = (const void *) previous + previous_index->size;
     }
   if ((const char *) current + sizeof (struct rec_idx_file_index_s)
-      > idx_file->buffer)
+      > idx_file->buffer + idx_file->size)
     {
       return NULL;
     }
   if ((const char *) current + sizeof (struct rec_idx_file_index_s)
-      + current->size > idx_file->buffer)
+      + current->size > idx_file->buffer + idx_file->size)
     {
       return NULL;
     }
-- 
1.7.11.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]