Skip to content
Snippets Groups Projects
Commit 45363fee authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

NUL-terminate the SMB fileidxrec_t.name field, just in case

The terminating NUL is actually part of the index record, but with file
corruption, it's technically possible the NUL could be missing.
Fixes CID 509552

Use strnicmp() insted of stricmp() in smb_removefile()
Fixes CID 509551
parent daa1b788
No related branches found
No related tags found
No related merge requests found
......@@ -237,6 +237,7 @@ int smb_findfile(smb_t* smb, const char* filename, smbfile_t* file)
if(smb_fread(smb, &fidx, sizeof(fidx), smb->sid_fp) != sizeof(fidx))
break;
TERMINATE(fidx.name);
f->idx_offset = offset++;
......@@ -438,7 +439,7 @@ int smb_removefile(smb_t* smb, smbfile_t* file)
}
rewind(smb->sid_fp);
for(uint32_t i = 0; i < smb->status.total_files; i++) {
if(stricmp(fidx[i].name, fname) == 0) {
if(strnicmp(fidx[i].name, fname, sizeof(fname) - 1) == 0) {
removed++;
continue;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment