From: florian Date: Wed, 14 Dec 2022 18:32:26 +0000 (+0000) Subject: The argument to ctype functions must be EOF or representable as an X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bc25f96dc3113b6979fb82cc1a9aa620bba7f47f;p=openbsd The argument to ctype functions must be EOF or representable as an unsigned char. Casting to int is particularly useless because that's what the compiler already does. We need to prevent sign extension, not write down that we want sign extension. OK deraadt, millert, kn --- diff --git a/usr.sbin/acme-client/http.c b/usr.sbin/acme-client/http.c index da7e2c23607..b7cead5fb2d 100644 --- a/usr.sbin/acme-client/http.c +++ b/usr.sbin/acme-client/http.c @@ -1,4 +1,4 @@ -/* $Id: http.c,v 1.31 2021/09/14 16:37:20 tb Exp $ */ +/* $Id: http.c,v 1.32 2022/12/14 18:32:26 florian Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons * @@ -561,7 +561,7 @@ http_head_parse(const struct http *http, struct httpxfer *trans, size_t *sz) } *ccp++ = '\0'; - while (isspace((int)*ccp)) + while (isspace((unsigned char)*ccp)) ccp++; h[hsz].key = cp; h[hsz++].val = ccp; diff --git a/usr.sbin/acme-client/netproc.c b/usr.sbin/acme-client/netproc.c index 1d59de71700..cd1b8716ca7 100644 --- a/usr.sbin/acme-client/netproc.c +++ b/usr.sbin/acme-client/netproc.c @@ -1,4 +1,4 @@ -/* $Id: netproc.c,v 1.32 2022/11/09 19:11:14 mbuhl Exp $ */ +/* $Id: netproc.c,v 1.33 2022/12/14 18:32:26 florian Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons * @@ -73,13 +73,13 @@ buf_dump(const struct buf *buf) err(EXIT_FAILURE, "malloc"); for (j = 0, i = 0; i < buf->sz; i++) - if (isspace((int)buf->buf[i])) { + if (isspace((unsigned char)buf->buf[i])) { nbuf[j++] = ' '; - while (isspace((int)buf->buf[i])) + while (isspace((unsigned char)buf->buf[i])) i++; i--; } else - nbuf[j++] = isprint((int)buf->buf[i]) ? + nbuf[j++] = isprint((unsigned char)buf->buf[i]) ? buf->buf[i] : '?'; dodbg("transfer buffer: [%.*s] (%zu bytes)", j, nbuf, buf->sz); free(nbuf); diff --git a/usr.sbin/acme-client/revokeproc.c b/usr.sbin/acme-client/revokeproc.c index fee2d56a162..d1dbba7b4e7 100644 --- a/usr.sbin/acme-client/revokeproc.c +++ b/usr.sbin/acme-client/revokeproc.c @@ -1,4 +1,4 @@ -/* $Id: revokeproc.c,v 1.20 2022/12/14 15:44:13 otto Exp $ */ +/* $Id: revokeproc.c,v 1.21 2022/12/14 18:32:26 florian Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons * @@ -225,7 +225,7 @@ revokeproc(int fd, const char *certfile, int force, while ((tok = strsep(&str, ",")) != NULL) { if (*tok == '\0') continue; - while (isspace((int)*tok)) + while (isspace((unsigned char)*tok)) tok++; if (strncmp(tok, "DNS:", 4)) continue;