From 02993e7f7d215ae29a041941d686ceab965d0b97 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 20 Mar 2017 20:57:34 +0100
Subject: Taken the last byte into account when analyzing the string section.

---
 ChangeLog                | 5 +++++
 src/format/elf/strings.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0bf54a6..53b4404 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 17-03-20  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/format/elf/strings.c:
+	Take the last byte into account when analyzing the string section.
+
+17-03-20  Cyrille Bagard <nocbos@gmail.com>
+
 	* plugins/pychrysa/format/symbol.c:
 	* src/analysis/disass/output.c:
 	Update code.
diff --git a/src/format/elf/strings.c b/src/format/elf/strings.c
index 799b8fe..755163e 100644
--- a/src/format/elf/strings.c
+++ b/src/format/elf/strings.c
@@ -186,10 +186,10 @@ bool parse_elf_string_data(GElfFormat *format, phys_t start, phys_t size, virt_t
             for (end = i + 1; end < size; end++)
                 if (!isprint(data[end])) break;
 
-            if (isspace(data[end]) && (end + 1) < size)
+            if (end < size && isspace(data[end]))
                 end++;
 
-            if (data[end] == '\0' && (end + 1) < size)
+            if (end < size && data[end] == '\0')
                 end++;
 
             init_vmpa(&pos, start + i, address + i);
-- 
cgit v0.11.2-87-g4458