Skip to content

Commit ef323d0

Browse files
committed
check for end pointer, too
1 parent c778b20 commit ef323d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bin/radlock.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ int main(int argc, char *argv[])
9090
int c;
9191
fr_radlock_action_t action;
9292
char const *file;
93+
char *end;
9394
uid_t uid = geteuid();
9495
bool uid_set = false;
9596
gid_t gid = getegid();
@@ -129,8 +130,8 @@ int main(int argc, char *argv[])
129130
break;
130131

131132
case 'm':
132-
mode = strtol(optarg, NULL, 0); /* 0 base plus 0 prefix = octal */
133-
if (errno == EINVAL) {
133+
mode = strtol(optarg, &end, 0); /* 0 base plus 0 prefix = octal */
134+
if (*end || (end == optarg)) {
134135
fr_perror("radlock - Bad mode value");
135136
EXIT_WITH_FAILURE;
136137
}

0 commit comments

Comments
 (0)