Skip to content

Commit 04da795

Browse files
committed
Problem: isdigit() receives a char* instead of char
Solution: as a quick fix, pick the first char of the string we pass. The proper fix would be to use the str_*() API for safe conversions, in a later iteration. See-also: networkupstools#676 Signed-off-by: Jim Klimov <EvgenyKlimov@eaton.com>
1 parent 28c2306 commit 04da795

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/conf.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int parse_upsd_conf_args(int numargs, char **arg)
122122

123123
/* MAXAGE <seconds> */
124124
if (!strcmp(arg[0], "MAXAGE")) {
125-
if (isdigit(arg[1])) {
125+
if (isdigit(arg[1][0])) {
126126
maxage = atoi(arg[1]);
127127
return 1;
128128
}
@@ -134,7 +134,7 @@ static int parse_upsd_conf_args(int numargs, char **arg)
134134

135135
/* TRACKINGDELAY <seconds> */
136136
if (!strcmp(arg[0], "TRACKINGDELAY")) {
137-
if (isdigit(arg[1])) {
137+
if (isdigit(arg[1][0])) {
138138
tracking_delay = atoi(arg[1]);
139139
return 1;
140140
}
@@ -146,7 +146,7 @@ static int parse_upsd_conf_args(int numargs, char **arg)
146146

147147
/* MAXCONN <connections> */
148148
if (!strcmp(arg[0], "MAXCONN")) {
149-
if (isdigit(arg[1])) {
149+
if (isdigit(arg[1][0])) {
150150
maxconn = atoi(arg[1]);
151151
return 1;
152152
}
@@ -187,7 +187,7 @@ static int parse_upsd_conf_args(int numargs, char **arg)
187187
#ifdef WITH_CLIENT_CERTIFICATE_VALIDATION
188188
/* CERTREQUEST (0 | 1 | 2) */
189189
if (!strcmp(arg[0], "CERTREQUEST")) {
190-
if (isdigit(arg[1])) {
190+
if (isdigit(arg[1][0])) {
191191
certrequest = atoi(arg[1]);
192192
return 1;
193193
}

0 commit comments

Comments
 (0)