commit 8b1391b

Michael Forney  ·  2026-04-03 00:27:30 +0000 UTC
parent d33a45e
oksh: Fix implicit argument conversion
3 files changed,  +65, -1
+1, -0
1@@ -79,6 +79,7 @@
2 [submodule "pkg/oksh/src"]
3 	path = pkg/oksh/src
4 	url = https://github.com/ibara/oksh.git
5+	ignore = all
6 [submodule "pkg/openssh/src"]
7 	path = pkg/openssh/src
8 	url = https://github.com/oasislinux/openssh.git
+63, -0
 1@@ -0,0 +1,63 @@
 2+From 537b64d1d0b49c4e74c66e2de98ce2dee51a1905 Mon Sep 17 00:00:00 2001
 3+From: Michael Forney <mforney@mforney.org>
 4+Date: Thu, 2 Apr 2026 17:24:45 -0700
 5+Subject: [PATCH] oksh: Avoid implicit parameter conversion to char *
 6+
 7+kb_entry.seq is always used with string functions, so make it a
 8+char * instead.
 9+---
10+ emacs.c | 4 ++--
11+ misc.c  | 6 +++---
12+ 2 files changed, 5 insertions(+), 5 deletions(-)
13+
14+diff --git a/emacs.c b/emacs.c
15+index 78ac2e4..b2c7ab2 100644
16+--- a/emacs.c
17++++ b/emacs.c
18+@@ -78,7 +78,7 @@ typedef enum {
19+ /* keybindings */
20+ struct kb_entry {
21+ 	TAILQ_ENTRY(kb_entry)	entry;
22+-	unsigned char		*seq;
23++	char			*seq;
24+ 	int			len;
25+ 	struct x_ftab		*ftab;
26+ 	void			*args;
27+@@ -1343,7 +1343,7 @@ kb_add_string(kb_func func, void *args, char *str)
28+ 	count = strlen(str);
29+ 
30+ 	k = alloc(sizeof *k + count + 1, AEDIT);
31+-	k->seq = (unsigned char *)(k + 1);
32++	k->seq = (char *)(k + 1);
33+ 	k->len = count;
34+ 	k->ftab = xf;
35+ 	k->args = args ? strdup(args) : NULL;
36+diff --git a/misc.c b/misc.c
37+index 428f183..9696230 100644
38+--- a/misc.c
39++++ b/misc.c
40+@@ -714,10 +714,10 @@ do_gmatch(const unsigned char *s, const unsigned char *se,
41+ }
42+ 
43+ static int
44+-posix_cclass(const unsigned char *pattern, int test, const unsigned char **ep)
45++posix_cclass(const char *pattern, int test, const unsigned char **ep)
46+ {
47+ 	const struct cclass *cc;
48+-	const unsigned char *colon;
49++	const char *colon;
50+ 	size_t len;
51+ 	int rval = 0;
52+ 
53+@@ -754,7 +754,7 @@ cclass(const unsigned char *p, int sub)
54+ 		if ((p[0] == MAGIC && p[1] == '[' && p[2] == ':') ||
55+ 		    (p[0] == '[' && p[1] == ':')) {
56+ 			do {
57+-				const char *pp = p + (*p == MAGIC) + 2;
58++				const char *pp = (char *)p + (*p == MAGIC) + 2;
59+ 				rv = posix_cclass(pp, sub, &p);
60+ 				switch (rv) {
61+ 				case 1:
62+-- 
63+2.49.0
64+
+1, -1
1@@ -1 +1 @@
2-7.8 r0
3+7.8 r1