[coverity] 1543257 Buffer not null terminated

This commit is contained in:
akallabeth 2024-04-11 10:17:41 +02:00 committed by akallabeth
parent 1473931ecd
commit 9768a5f48f

View File

@ -885,7 +885,7 @@ static WIN32_FILE_SEARCH* file_search_new(const char* name, size_t namelen, cons
WIN32_FILE_SEARCH* pFileSearch = (WIN32_FILE_SEARCH*)calloc(1, sizeof(WIN32_FILE_SEARCH));
if (!pFileSearch)
return NULL;
strncpy(pFileSearch->magic, file_search_magic, sizeof(pFileSearch->magic));
strncpy(pFileSearch->magic, file_search_magic, sizeof(pFileSearch->magic) - 1);
pFileSearch->lpPath = strndup(name, namelen);
pFileSearch->lpPattern = strndup(pattern, patternlen);