Skip to content

Commit

Permalink
Fix #111: Use correct length filename for too large test
Browse files Browse the repository at this point in the history
  • Loading branch information
irowebbn committed Jun 20, 2023
1 parent 2a6c6a2 commit 0bedf4c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions unit-test/ds_file_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,11 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameTooLarge(void)
/* Set up the handle */
OS_OpenCreate(&DS_AppData.FileStatus[FileIndex].FileHandle, NULL, 0, 0);

strncpy(DS_AppData.FileStatus[FileIndex].FileName, "directory1/filenamefilenamefilenamefilenamefilenamefilename",
sizeof(DS_AppData.FileStatus[FileIndex].FileName));
const char DirName[] = "directory1/";
size_t DirNameLen = sizeof(DirName)/sizeof(char);
strncpy(DS_AppData.FileStatus[FileIndex].FileName, DirName, DirNameLen);
memset(&DS_AppData.FileStatus[FileIndex].FileName[DirNameLen-1], 'f', DS_TOTAL_FNAME_BUFSIZE - DirNameLen);
DS_AppData.FileStatus[FileIndex].FileName[DS_TOTAL_FNAME_BUFSIZE-1] = '\0';
strncpy(DS_AppData.DestFileTblPtr->File[FileIndex].Movename, "directory2/movename/",
sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename));

Expand Down

0 comments on commit 0bedf4c

Please sign in to comment.