Coverity: CID 400831: Out of bonds access
authorNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 7 Mar 2012 14:32:01 +0000 (09:32 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 7 Mar 2012 14:32:01 +0000 (09:32 -0500)
* src/fileio.c: Provide proper length to xstrncat

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/fileio.c

index bae112a..4145646 100644 (file)
@@ -1034,7 +1034,7 @@ See also the function `substitute-in-file-name'.
                        file_name_as_directory((char *)target, (char *)newdir, tlen);
        }
 
-       xstrncat((char *)target, (char *)nm, tlen);
+       xstrncat((char *)target, (char *)nm, tlen-1);
 
        /* ASSERT (IS_DIRECTORY_SEP (target[0])) if not VMS */