Commit 9ae9a634 authored by deuce's avatar deuce
Browse files

Only copy up to MAX_PATH characters to each component in _splitpath()

Fixes coverity warning in SyncTERM... matches the size all callers currently
use.
parent b9646527
......@@ -152,16 +152,16 @@ void DLLCALL _splitpath(const char *path, char *drive, char *dir, char *fname, c
ext[0]=0;
drive[0]=0; /* no drive letters on Unix */
strcpy(dir,path); /* Optional directory path, including trailing slash. */
snprintf(dir, MAX_PATH+1, "%s", path); /* Optional directory path, including trailing slash. */
p=getfname(dir);
strcpy(fname,p); /* Base filename (no extension) */
snprintf(fname, MAX_PATH+1, "%s", p); /* Base filename (no extension) */
if(p==dir)
dir[0]=0; /* no directory specified in path */
else
*p=0; /* truncate dir at filename */
p=getfext(fname);
if(p!=NULL) {
strcpy(ext,p); /* Optional filename extension, including leading period (.) */
snprintf(ext, MAX_PATH+1, "%s", p); /* Optional filename extension, including leading period (.) */
*p=0;
}
}
......
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