Module Name: src
Committed By: tih
Date: Mon Aug 30 06:27:49 UTC 2021
Modified Files:
src/usr.sbin/inetd: parse_v2.c
Log Message:
Summary: char is unsigned on arm, so use int when -1 indicates error
hex_to_bits() returns -1 on error, so declare it int, and do the same
for the variables that hold intermediate values returned by it.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/inetd/parse_v2.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/inetd/parse_v2.c
diff -u src/usr.sbin/inetd/parse_v2.c:1.1 src/usr.sbin/inetd/parse_v2.c:1.2
--- src/usr.sbin/inetd/parse_v2.c:1.1 Sun Aug 29 09:54:18 2021
+++ src/usr.sbin/inetd/parse_v2.c Mon Aug 30 06:27:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: parse_v2.c,v 1.1 2021/08/29 09:54:18 christos Exp $ */
+/* $NetBSD: parse_v2.c,v 1.2 2021/08/30 06:27:49 tih Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: parse_v2.c,v 1.1 2021/08/29 09:54:18 christos Exp $");
+__RCSID("$NetBSD: parse_v2.c,v 1.2 2021/08/30 06:27:49 tih Exp $");
#include <ctype.h>
#include <errno.h>
@@ -95,7 +95,7 @@ static int size_to_bytes(char *);
static bool infer_protocol_ip_version(struct servtab *);
static bool setup_internal(struct servtab *);
static void try_infer_socktype(struct servtab *);
-char hex_to_bits(char);
+int hex_to_bits(char);
#ifdef IPSEC
static void setup_ipsec(struct servtab *);
#endif
@@ -405,7 +405,7 @@ parse_quotes(char **cpp)
cp++;
switch (*cp) {
case 'x': {
- char temp, bits;
+ int temp, bits;
if (((bits = hex_to_bits(*(cp + 1))) == -1)
|| ((temp = hex_to_bits(*(cp + 2))) == -1)) {
ERR("Invalid hexcode sequence '%.4s'",
@@ -459,7 +459,7 @@ parse_quotes(char **cpp)
return true;
}
-char
+int
hex_to_bits(char in)
{
switch(in) {