summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-04-28 19:24:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-04-28 19:24:15 (GMT)
commitaeffe7a3bc85a2ddf30e309a59f14a0ecb7a824e (patch)
treef86f6af8032b1bc0e62bfb82539b9df61fc56e6a
parentac75fdb77854c6f6d2e8db97a474c8bf3af2b0c4 (diff)
RTFM'ed to avoid segfaults when calling isprint().
-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;"));