]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Just adjust ext when removing "mod_" (CID #1504300) (#4506)
authorJames Jones <jejones3141@gmail.com>
Thu, 12 May 2022 14:03:46 +0000 (09:03 -0500)
committerGitHub <noreply@github.com>
Thu, 12 May 2022 14:03:46 +0000 (10:03 -0400)
One need only adjust ext by 4 when, in truncate_dll_name(), one
removes "mod_". Then if len exceeds 8 ext still points at the
extension, and coverity can't kvetch about not checking the value
strchr() returns (Using strchr() the second time means
"mumblefrotz.foo.dll" won't behave as expected; does that ever
turn up in practice?)

scripts/jlibtool.c

index 04e849f85fb2e65c09a0066018bb58821bbc3b11..d4c58eea3336a1d08e803e0ac6f8df55e8091ab9 100644 (file)
@@ -1249,12 +1249,11 @@ static char *truncate_dll_name(char const *path)
 
        if (strncmp(newname, "mod_", 4) == 0) {
                memmove(newname, newname + 4, len + ext_len - 4 + 1);
+               ext -= 4;
                len -= 4;
        }
 
-       if (len > 8) {
-               memmove(newname + 8, strchr(newname, '.'), ext_len + 1);
-       }
+       if (len > 8) memmove(newname + 8, ext, ext_len + 1);
 
        return tmppath;
 }