diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2023-08-07 12:46:40 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-08-07 10:46:40 +0000 |
commit | 43abfff43537092e20bc129f8208d082e73aff1a (patch) | |
tree | 0a474a6ecf44fd9b0090d75f0f528fb9b55e62ce /modules/pam_faillock/faillock_config.c | |
parent | 4020ca8c0fe3ac88eccc5c62aa8d8c63a4043578 (diff) | |
download | pam-43abfff43537092e20bc129f8208d082e73aff1a.tar.gz pam-43abfff43537092e20bc129f8208d082e73aff1a.tar.bz2 pam-43abfff43537092e20bc129f8208d082e73aff1a.zip |
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
Diffstat (limited to 'modules/pam_faillock/faillock_config.c')
-rw-r--r-- | modules/pam_faillock/faillock_config.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/pam_faillock/faillock_config.c b/modules/pam_faillock/faillock_config.c index 0d14aad1..5d796240 100644 --- a/modules/pam_faillock/faillock_config.c +++ b/modules/pam_faillock/faillock_config.c @@ -121,7 +121,7 @@ read_config_file(pam_handle_t *pamh, struct options *opts, const char *cfgfile) /* drop terminating whitespace including the \n */ while (ptr > linebuf) { - if (!isspace(*(ptr-1))) { + if (!isspace((unsigned char)*(ptr-1))) { *ptr = '\0'; break; } @@ -129,7 +129,7 @@ read_config_file(pam_handle_t *pamh, struct options *opts, const char *cfgfile) } /* skip initial whitespace */ - for (ptr = linebuf; isspace(*ptr); ptr++); + for (ptr = linebuf; isspace((unsigned char)*ptr); ptr++); if (*ptr == '\0') continue; @@ -137,7 +137,7 @@ read_config_file(pam_handle_t *pamh, struct options *opts, const char *cfgfile) eq = 0; name = ptr; while (*ptr != '\0') { - if (isspace(*ptr) || *ptr == '=') { + if (isspace((unsigned char)*ptr) || *ptr == '=') { eq = *ptr == '='; *ptr = '\0'; ++ptr; @@ -149,7 +149,7 @@ read_config_file(pam_handle_t *pamh, struct options *opts, const char *cfgfile) /* grab the key value */ while (*ptr != '\0') { if (*ptr != '=' || eq) { - if (!isspace(*ptr)) { + if (!isspace((unsigned char)*ptr)) { break; } } else { |