]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
check for end pointer, too
authorAlan T. DeKok <aland@freeradius.org>
Fri, 6 Mar 2026 01:25:01 +0000 (20:25 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 6 Mar 2026 01:48:04 +0000 (20:48 -0500)
src/bin/radlock.c

index 3f994ba7751b6a50b2bae0c62c92c23d4a96accc..93dc05260b7ce9dec2d77a1ec2958d61679ba535 100644 (file)
@@ -90,6 +90,7 @@ int main(int argc, char *argv[])
        int                     c;
        fr_radlock_action_t     action;
        char const              *file;
+       char                    *end;
        uid_t                   uid = geteuid();
        bool                    uid_set = false;
        gid_t                   gid = getegid();
@@ -129,8 +130,8 @@ int main(int argc, char *argv[])
                        break;
 
                case 'm':
-                       mode = strtol(optarg, NULL, 0); /* 0 base plus 0 prefix = octal */
-                       if (errno == EINVAL) {
+                       mode = strtol(optarg, &end, 0); /* 0 base plus 0 prefix = octal */
+                       if (*end || (end == optarg)) {
                                fr_perror("radlock - Bad mode value");
                                EXIT_WITH_FAILURE;
                        }