Commit 063d4700 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Address Coverty reported issue about dereferencing a NULL pointer

CID 345291
It's actually a false positive because if an extension (".suffix") exists in filespec, it must also exist in newfilespec since it's a copy, but whatever. It's better form to check.
parent 55962a41
Pipeline #2573 passed with stage
in 9 minutes and 19 seconds
......@@ -195,11 +195,12 @@ file_t* loadfiles(smb_t* smb, const char* filespec, time_t t, enum file_detail d
size_t len = strlen(filespec);
if(len >= 12 && strcspn(filespec, "*?") == len) {
SAFECOPY(newfilespec, filespec);
char* ext = getfext(newfilespec);
if(ext != NULL) {
*ext = 0;
char* ext = getfext(filespec);
char* newext = getfext(newfilespec);
if(ext != NULL && newext != NULL) {
*newext = 0;
SAFECAT(newfilespec, "*");
SAFECAT(newfilespec, getfext(filespec));
SAFECAT(newfilespec, ext);
} else
SAFECAT(newfilespec, "*");
filespec = newfilespec;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment