]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
util: fix potential OOB write in the symlinks build helper
authorTheodore Ts'o <tytso@mit.edu>
Thu, 22 May 2025 04:53:02 +0000 (00:53 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 22 May 2025 04:53:02 +0000 (00:53 -0400)
Addresses-Coverity-Bug: 1432089
Addresses-Coverity-Bug: 1433050
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
util/symlinks.c

index 4b0b788e0f4f30b19f4adb3dfdfa61360a2f8db0..cb74fc78515041a2795ad96222b960eb2d73bb51 100644 (file)
@@ -56,7 +56,7 @@ static int substr (char *s, char *old, char *new)
                newlen = strlen(new);
 
        if (newlen > oldlen) {
-               if ((tmp = malloc(strlen(s))) == NULL) {
+               if ((tmp = malloc(strlen(s)+1)) == NULL) {
                        fprintf(stderr, "no memory\n");
                        exit (1);
                }