summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/arch/immediate.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c999c6b..d8c2850 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+17-04-28 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/arch/immediate.c:
+ RTFM to avoid segfaults when calling isprint().
+
17-04-27 Cyrille Bagard <nocbos@gmail.com>
* configure.ac:
diff --git a/src/arch/immediate.c b/src/arch/immediate.c
index 6ae7b66..18c798d 100644
--- a/src/arch/immediate.c
+++ b/src/arch/immediate.c
@@ -27,6 +27,7 @@
#include <assert.h>
#include <ctype.h>
#include <inttypes.h>
+#include <limits.h>
#include <malloc.h>
#include <stdarg.h>
#include <stdio.h>
@@ -1122,7 +1123,7 @@ static char *g_imm_operand_build_tooltip(const GImmOperand *operand, const GLoad
char value[IMM_MAX_SIZE]; /* Conversion artificielle */
char *conv; /* Affichage de la Conversion */
- if (isprint(operand->raw))
+ if (operand->raw <= UCHAR_MAX && isprint(operand->raw))
asprintf(&result, _("Character: '%c'"), (char)operand->raw);
else
asprintf(&result, _("Character: &lt;not printable&gt;"));