Merge pull request #1290 from edenzik/ezik/1119-safe-strcpy-in-fileio

Fixed unsafe string copy and concat in `fileio.c`.
This commit is contained in:
Yann Collet 2018-08-21 13:18:44 -07:00 committed by GitHub
commit 801e3bcd97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -1011,8 +1011,8 @@ int FIO_compressMultipleFilenames(const char** inFileNamesTable, unsigned nbFile
if (!dstFileName) {
EXM_THROW(30, "zstd: %s", strerror(errno));
} }
strcpy(dstFileName, inFileNamesTable[u]);
strcat(dstFileName, suffix);
strncpy(dstFileName, inFileNamesTable[u], ifnSize+1 /* Include null */);
strncat(dstFileName, suffix, suffixSize);
missed_files += FIO_compressFilename_dstFile(ress, dstFileName, inFileNamesTable[u], compressionLevel);
} }

1
tests/.gitignore vendored
View File

@ -26,6 +26,7 @@ invalidDictionaries
checkTag
zcat
zstdcat
tm
# Tmp test directory
zstdtest