>From 71958eb7080485d7291b8b622b09e6b198f0d920 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 2 Apr 2021 19:47:53 +0200 Subject: [PATCH 1/7] strto*l: Don't pass invalid arguments to isspace, isalnum, toupper. * lib/strtol.c (ISSPACE, ISALPHA, TOUPPER): Cast argument to 'unsigned char' before passing it to the functions isspace(), isalpha(), toupper(). --- ChangeLog | 7 +++++++ lib/strtol.c | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4e766f..0bf4c58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2021-04-02 Bruno Haible + strto*l: Don't pass invalid arguments to isspace, isalnum, toupper. + * lib/strtol.c (ISSPACE, ISALPHA, TOUPPER): Cast argument to + 'unsigned char' before passing it to the functions isspace(), isalpha(), + toupper(). + +2021-04-02 Bruno Haible + glob: Reject ~user syntax, when flag GLOB_TILDE_CHECK is given. Reported and patch suggested by Eli Zaretskii in . diff --git a/lib/strtol.c b/lib/strtol.c index 2f2159b..14836d0 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -166,13 +166,13 @@ # define UCHAR_TYPE unsigned char # define STRING_TYPE char # ifdef USE_IN_EXTENDED_LOCALE_MODEL -# define ISSPACE(Ch) __isspace_l ((Ch), loc) -# define ISALPHA(Ch) __isalpha_l ((Ch), loc) -# define TOUPPER(Ch) __toupper_l ((Ch), loc) +# define ISSPACE(Ch) __isspace_l ((unsigned char) (Ch), loc) +# define ISALPHA(Ch) __isalpha_l ((unsigned char) (Ch), loc) +# define TOUPPER(Ch) __toupper_l ((unsigned char) (Ch), loc) # else -# define ISSPACE(Ch) isspace (Ch) -# define ISALPHA(Ch) isalpha (Ch) -# define TOUPPER(Ch) toupper (Ch) +# define ISSPACE(Ch) isspace ((unsigned char) (Ch)) +# define ISALPHA(Ch) isalpha ((unsigned char) (Ch)) +# define TOUPPER(Ch) toupper ((unsigned char) (Ch)) # endif #endif -- 2.7.4