mirror of
https://github.com/facebook/zstd.git
synced 2025-01-10 17:58:44 +08:00
Merge pull request #3304 from GermanAizek/dev
Rewrite check *bufStart condition
This commit is contained in:
commit
bb23f7b99b
@ -693,8 +693,11 @@ static int UTIL_prepareFileList(const char *dirName,
|
||||
ptrdiff_t newListSize = (*bufEnd - *bufStart) + LIST_SIZE_INCREASE;
|
||||
assert(newListSize >= 0);
|
||||
*bufStart = (char*)UTIL_realloc(*bufStart, (size_t)newListSize);
|
||||
*bufEnd = *bufStart + newListSize;
|
||||
if (*bufStart == NULL) { free(path); closedir(dir); return 0; }
|
||||
if (*bufStart != NULL) {
|
||||
*bufEnd = *bufStart + newListSize;
|
||||
} else {
|
||||
free(path); closedir(dir); return 0;
|
||||
}
|
||||
}
|
||||
if (*bufStart + *pos + pathLength < *bufEnd) {
|
||||
memcpy(*bufStart + *pos, path, pathLength + 1); /* with final \0 */
|
||||
|
Loading…
Reference in New Issue
Block a user