isspace() and isalnum() should not be given arguments in the range -0x80 .. -0x01, says POSIX: https://pubs.opengroup.org/onlinepubs/9699919799/functions/isspace.html https://pubs.opengroup.org/onlinepubs/9699919799/functions/isalnum.html
This patch fixes argp-help.c accordingly. (Although, admittedly, most people only pass ASCII strings as long options.) 2020-12-08 Bruno Haible <br...@clisp.org> argp: Don't pass invalid arguments to isspace() and isalnum(). * lib/argp-help.c (canon_doc_option): Cast character to 'unsigned int' before passing it to isspace() or isalnum(). diff --git a/lib/argp-help.c b/lib/argp-help.c index 03fc6c7..acab001 100644 --- a/lib/argp-help.c +++ b/lib/argp-help.c @@ -720,12 +720,12 @@ canon_doc_option (const char **name) { int non_opt; /* Skip initial whitespace. */ - while (isspace (**name)) + while (isspace ((unsigned char) **name)) (*name)++; /* Decide whether this looks like an option (leading '-') or not. */ non_opt = (**name != '-'); /* Skip until part of name used for sorting. */ - while (**name && !isalnum (**name)) + while (**name && !isalnum ((unsigned char) **name)) (*name)++; return non_opt; }