From 43abfff43537092e20bc129f8208d082e73aff1a Mon Sep 17 00:00:00 2001 From: Christian Göttsche Date: Mon, 7 Aug 2023 12:46:40 +0200 Subject: modules: cast to unsigned char for character handling function Character handling functions, like isspace(3), expect a value representable as unsigned char or equal to EOF. Otherwise the behavior is undefined. See https://wiki.sei.cmu.edu/confluence/display/c/STR37-C.+Arguments+to+character-handling+functions+must+be+representable+as+an+unsigned+char --- modules/pam_pwhistory/opasswd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/pam_pwhistory') diff --git a/modules/pam_pwhistory/opasswd.c b/modules/pam_pwhistory/opasswd.c index fc610e2f..6e44ed2a 100644 --- a/modules/pam_pwhistory/opasswd.c +++ b/modules/pam_pwhistory/opasswd.c @@ -199,7 +199,7 @@ check_old_pass, const char *user, const char *newpass, const char *filename, int tmp = strchr (cp, '#'); /* remove comments */ if (tmp) *tmp = '\0'; - while (isspace ((int)*cp)) /* remove spaces and tabs */ + while (isspace ((unsigned char)*cp)) /* remove spaces and tabs */ ++cp; if (*cp == '\0') /* ignore empty lines */ continue; @@ -420,7 +420,7 @@ save_old_pass, const char *user, int howmany, const char *filename, int debug UN tmp = strchr (cp, '#'); /* remove comments */ if (tmp) *tmp = '\0'; - while (isspace ((int)*cp)) /* remove spaces and tabs */ + while (isspace ((unsigned char)*cp)) /* remove spaces and tabs */ ++cp; if (*cp == '\0') /* ignore empty lines */ goto write_old_data; -- cgit v1.2.3