summaryrefslogtreecommitdiff
path: root/sbin/ipsecctl
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@cvs.openbsd.org>2021-10-15 15:01:30 +0000
committerChristian Weisgerber <naddy@cvs.openbsd.org>2021-10-15 15:01:30 +0000
commit1962f7440266854ff99ccbcccdb8901d4a390f3b (patch)
treea370187304af1b3e92149ae0b83ab036b229cba8 /sbin/ipsecctl
parent419d75fa85d117d2faff0336cca5f20917cc3bfb (diff)
Don't declare variables as "unsigned char *" that are passed to
functions that take "char *" arguments. Where such chars are assigned to int or passed to ctype functions, explicitly cast them to unsigned char. For OpenBSD's clang, -Wpointer-sign has been disabled by default, but when the parse.y code was built elsewhere, the compiler would complain. With help from millert@ ok benno@ deraadt@
Diffstat (limited to 'sbin/ipsecctl')
-rw-r--r--sbin/ipsecctl/parse.y26
1 files changed, 13 insertions, 13 deletions
diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y
index 352526452b0..6780b5385ff 100644
--- a/sbin/ipsecctl/parse.y
+++ b/sbin/ipsecctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.179 2020/12/29 19:50:03 benno Exp $ */
+/* $OpenBSD: parse.y,v 1.180 2021/10/15 15:01:27 naddy Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1054,9 +1054,9 @@ lookup(char *s)
#define MAXPUSHBACK 128
-u_char *parsebuf;
+char *parsebuf;
int parseindex;
-u_char pushback_buffer[MAXPUSHBACK];
+char pushback_buffer[MAXPUSHBACK];
int pushback_index = 0;
int
@@ -1067,7 +1067,7 @@ lgetc(int quotec)
if (parsebuf) {
/* Read character from the parsebuffer instead of input. */
if (parseindex >= 0) {
- c = parsebuf[parseindex++];
+ c = (unsigned char)parsebuf[parseindex++];
if (c != '\0')
return (c);
parsebuf = NULL;
@@ -1076,7 +1076,7 @@ lgetc(int quotec)
}
if (pushback_index)
- return (pushback_buffer[--pushback_index]);
+ return ((unsigned char)pushback_buffer[--pushback_index]);
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
@@ -1116,10 +1116,10 @@ lungetc(int c)
if (parseindex >= 0)
return (c);
}
- if (pushback_index < MAXPUSHBACK-1)
- return (pushback_buffer[pushback_index++] = c);
- else
+ if (pushback_index + 1 >= MAXPUSHBACK)
return (EOF);
+ pushback_buffer[pushback_index++] = c;
+ return (c);
}
int
@@ -1132,7 +1132,7 @@ findeol(void)
/* skip to either EOF or the first real EOL */
while (1) {
if (pushback_index)
- c = pushback_buffer[--pushback_index];
+ c = (unsigned char)pushback_buffer[--pushback_index];
else
c = lgetc(0);
if (c == '\n') {
@@ -1148,8 +1148,8 @@ findeol(void)
int
yylex(void)
{
- u_char buf[8096];
- u_char *p, *val;
+ char buf[8096];
+ char *p, *val;
int quotec, next, c;
int token;
@@ -1258,8 +1258,8 @@ top:
} else {
nodigits:
while (p > buf + 1)
- lungetc(*--p);
- c = *--p;
+ lungetc((unsigned char)*--p);
+ c = (unsigned char)*--p;
if (c == '-')
return (c);
}