aboutsummaryrefslogtreecommitdiff
path: root/libpam/pam_misc.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2023-08-07 12:46:27 +0200
committerDmitry V. Levin <ldv@strace.io>2023-08-07 10:46:40 +0000
commit65b5747e32067ffd1980ef06360737b3c30b0feb (patch)
tree1dab52c52d6149d35b57f2134bc70cf2d807b423 /libpam/pam_misc.c
parent2770046cd8c24eae69625f7cbab0b6995008bbf7 (diff)
downloadpam-65b5747e32067ffd1980ef06360737b3c30b0feb.tar.gz
pam-65b5747e32067ffd1980ef06360737b3c30b0feb.tar.bz2
pam-65b5747e32067ffd1980ef06360737b3c30b0feb.zip
libpam: 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 'libpam/pam_misc.c')
-rw-r--r--libpam/pam_misc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libpam/pam_misc.c b/libpam/pam_misc.c
index 996f23ce..449490c9 100644
--- a/libpam/pam_misc.c
+++ b/libpam/pam_misc.c
@@ -273,7 +273,7 @@ void _pam_parse_control(int *control_array, char *tok)
int act, len;
/* skip leading space */
- while (isspace((int)*tok) && *++tok);
+ while (isspace((unsigned char)*tok) && *++tok);
if (!*tok)
break;
@@ -290,14 +290,14 @@ void _pam_parse_control(int *control_array, char *tok)
}
/* observe '=' */
- while (isspace((int)*tok) && *++tok);
+ while (isspace((unsigned char)*tok) && *++tok);
if (!*tok || *tok++ != '=') {
error = "expecting '='";
goto parse_error;
}
/* skip leading space */
- while (isspace((int)*tok) && *++tok);
+ while (isspace((unsigned char)*tok) && *++tok);
if (!*tok) {
error = "expecting action";
goto parse_error;
@@ -322,7 +322,7 @@ void _pam_parse_control(int *control_array, char *tok)
* cause looping problems. So, for now, we will just
* allow forward jumps. (AGM 1998/1/7)
*/
- if (!isdigit((int)*tok)) {
+ if (!isdigit((unsigned char)*tok)) {
error = "expecting jump number";
goto parse_error;
}
@@ -331,7 +331,7 @@ void _pam_parse_control(int *control_array, char *tok)
do {
act *= 10;
act += *tok - '0'; /* XXX - this assumes ascii behavior */
- } while (*++tok && isdigit((int)*tok));
+ } while (*++tok && isdigit((unsigned char)*tok));
if (! act) {
/* we do not allow 0 jumps. There is a token ('ignore')
for that */