mirror of
https://github.com/oasislinux/oasis.git
synced 2026-10-04 12:07:12 +02:00
149 lines
5.2 KiB
Diff
149 lines
5.2 KiB
Diff
From d74af6c05b11f5d000f0a4aae3c287b6d4e2829f Mon Sep 17 00:00:00 2001
|
|
From: Michael Forney <mforney@mforney.org>
|
|
Date: Thu, 2 Apr 2026 17:02:47 -0700
|
|
Subject: [PATCH] Explicitly cast arguments to functions expecting char pointer
|
|
with other sign
|
|
|
|
---
|
|
usr.bin/diff/diffreg.c | 10 +++++-----
|
|
usr.bin/nc/socks.c | 30 +++++++++++++++---------------
|
|
usr.sbin/acme-client/acctproc.c | 3 ++-
|
|
3 files changed, 22 insertions(+), 21 deletions(-)
|
|
|
|
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
|
|
index 3470f54c337..c36765a44c8 100644
|
|
--- a/usr.bin/diff/diffreg.c
|
|
+++ b/usr.bin/diff/diffreg.c
|
|
@@ -1269,19 +1269,19 @@ match_function(const long *f, int pos, FILE *fp)
|
|
nc = fread(buf, 1, nc, fp);
|
|
if (nc > 0) {
|
|
buf[nc] = '\0';
|
|
- buf[strcspn(buf, "\n")] = '\0';
|
|
+ buf[strcspn((char *)buf, "\n")] = '\0';
|
|
if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {
|
|
- if (begins_with(buf, "private:")) {
|
|
+ if (begins_with((char *)buf, "private:")) {
|
|
if (!state)
|
|
state = " (private)";
|
|
- } else if (begins_with(buf, "protected:")) {
|
|
+ } else if (begins_with((char *)buf, "protected:")) {
|
|
if (!state)
|
|
state = " (protected)";
|
|
- } else if (begins_with(buf, "public:")) {
|
|
+ } else if (begins_with((char *)buf, "public:")) {
|
|
if (!state)
|
|
state = " (public)";
|
|
} else {
|
|
- strlcpy(lastbuf, buf, sizeof lastbuf);
|
|
+ strlcpy(lastbuf, (char *)buf, sizeof lastbuf);
|
|
if (state)
|
|
strlcat(lastbuf, state,
|
|
sizeof lastbuf);
|
|
diff --git a/usr.bin/nc/socks.c b/usr.bin/nc/socks.c
|
|
index 1f1fb96e2af..37a18f191f2 100644
|
|
--- a/usr.bin/nc/socks.c
|
|
+++ b/usr.bin/nc/socks.c
|
|
@@ -88,7 +88,7 @@ decode_addrport(const char *h, const char *p, struct sockaddr *addr,
|
|
}
|
|
|
|
static int
|
|
-proxy_read_line(int fd, char *buf, size_t bufsz)
|
|
+proxy_read_line(int fd, unsigned char *buf, size_t bufsz)
|
|
{
|
|
size_t off;
|
|
|
|
@@ -315,7 +315,7 @@ socks_connect(const char *host, const char *port,
|
|
wlen = 9;
|
|
if (socksv == 44) {
|
|
/* SOCKS4A has nul-terminated hostname after user */
|
|
- if (strlcpy(buf + 9, host,
|
|
+ if (strlcpy((char *)buf + 9, host,
|
|
sizeof(buf) - 9) >= sizeof(buf) - 9)
|
|
errx(1, "hostname too big");
|
|
wlen = 9 + strlen(host) + 1;
|
|
@@ -340,17 +340,17 @@ socks_connect(const char *host, const char *port,
|
|
|
|
/* Try to be sane about numeric IPv6 addresses */
|
|
if (strchr(host, ':') != NULL) {
|
|
- r = snprintf(buf, sizeof(buf),
|
|
+ r = snprintf((char *)buf, sizeof(buf),
|
|
"CONNECT [%s]:%d HTTP/1.0\r\n",
|
|
host, ntohs(serverport));
|
|
} else {
|
|
- r = snprintf(buf, sizeof(buf),
|
|
+ r = snprintf((char *)buf, sizeof(buf),
|
|
"CONNECT %s:%d HTTP/1.0\r\n",
|
|
host, ntohs(serverport));
|
|
}
|
|
if (r < 0 || (size_t)r >= sizeof(buf))
|
|
errx(1, "hostname too long");
|
|
- r = strlen(buf);
|
|
+ r = strlen((char *)buf);
|
|
|
|
cnt = atomicio(vwrite, proxyfd, buf, r);
|
|
if (cnt != r)
|
|
@@ -362,18 +362,18 @@ socks_connect(const char *host, const char *port,
|
|
|
|
getproxypass(proxyuser, proxyhost,
|
|
proxypass, sizeof proxypass);
|
|
- r = snprintf(buf, sizeof(buf), "%s:%s",
|
|
+ r = snprintf((char *)buf, sizeof(buf), "%s:%s",
|
|
proxyuser, proxypass);
|
|
explicit_bzero(proxypass, sizeof proxypass);
|
|
if (r == -1 || (size_t)r >= sizeof(buf) ||
|
|
- b64_ntop(buf, strlen(buf), resp,
|
|
+ b64_ntop(buf, strlen((char *)buf), resp,
|
|
sizeof(resp)) == -1)
|
|
errx(1, "Proxy username/password too long");
|
|
- r = snprintf(buf, sizeof(buf), "Proxy-Authorization: "
|
|
- "Basic %s\r\n", resp);
|
|
+ r = snprintf((char *)buf, sizeof(buf),
|
|
+ "Proxy-Authorization: Basic %s\r\n", resp);
|
|
if (r < 0 || (size_t)r >= sizeof(buf))
|
|
errx(1, "Proxy auth response too long");
|
|
- r = strlen(buf);
|
|
+ r = strlen((char *)buf);
|
|
if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != r)
|
|
err(1, "write failed (%zu/%d)", cnt, r);
|
|
explicit_bzero(proxypass, sizeof proxypass);
|
|
@@ -387,17 +387,17 @@ socks_connect(const char *host, const char *port,
|
|
/* Read status reply */
|
|
proxy_read_line(proxyfd, buf, sizeof(buf));
|
|
if (proxyuser != NULL &&
|
|
- (strncmp(buf, "HTTP/1.0 407 ", 13) == 0 ||
|
|
- strncmp(buf, "HTTP/1.1 407 ", 13) == 0)) {
|
|
+ (strncmp((char *)buf, "HTTP/1.0 407 ", 13) == 0 ||
|
|
+ strncmp((char *)buf, "HTTP/1.1 407 ", 13) == 0)) {
|
|
if (authretry > 1) {
|
|
fprintf(stderr, "Proxy authentication "
|
|
"failed\n");
|
|
}
|
|
close(proxyfd);
|
|
goto again;
|
|
- } else if (strncmp(buf, "HTTP/1.0 200 ", 13) != 0 &&
|
|
- strncmp(buf, "HTTP/1.1 200 ", 13) != 0)
|
|
- errx(1, "Proxy error: \"%s\"", buf);
|
|
+ } else if (strncmp((char *)buf, "HTTP/1.0 200 ", 13) != 0 &&
|
|
+ strncmp((char *)buf, "HTTP/1.1 200 ", 13) != 0)
|
|
+ errx(1, "Proxy error: \"%s\"", (char *)buf);
|
|
|
|
/* Headers continue until we hit an empty line */
|
|
for (r = 0; r < HTTP_MAXHDRS; r++) {
|
|
diff --git a/usr.sbin/acme-client/acctproc.c b/usr.sbin/acme-client/acctproc.c
|
|
index 8d66dac49d9..6bc647c6009 100644
|
|
--- a/usr.sbin/acme-client/acctproc.c
|
|
+++ b/usr.sbin/acme-client/acctproc.c
|
|
@@ -215,7 +215,8 @@ op_sign(int fd, struct key *key, enum acctop op)
|
|
|
|
/* Base64-encode the payload. */
|
|
|
|
- if ((pay64 = base64buf_url(pay, strlen(pay))) == NULL) {
|
|
+ if ((pay64 = base64buf_url((unsigned char *)pay,
|
|
+ strlen(pay))) == NULL) {
|
|
warnx("base64buf_url");
|
|
goto out;
|
|
}
|
|
--
|
|
2.49.0
|
|
|