From aeffe7a3bc85a2ddf30e309a59f14a0ecb7a824e Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 28 Apr 2017 21:24:15 +0200 Subject: RTFM'ed to avoid segfaults when calling isprint(). --- ChangeLog | 5 +++++ src/arch/immediate.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c999c6b..d8c2850 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +17-04-28 Cyrille Bagard + + * src/arch/immediate.c: + RTFM to avoid segfaults when calling isprint(). + 17-04-27 Cyrille Bagard * 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 #include #include +#include #include #include #include @@ -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: <not printable>")); -- cgit v0.11.2-87-g4458