mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2025-01-22 07:21:13 +00:00
Use the secure version of splitpath
Fixes VC++ warning about possible buffer overruns.
This commit is contained in:
parent
773edb5d53
commit
1898c7de69
1 changed files with 20 additions and 2 deletions
|
@ -298,7 +298,16 @@ std::string FileUtils::fileName(const char* path)
|
||||||
#else
|
#else
|
||||||
char baseName[MAX_PATH];
|
char baseName[MAX_PATH];
|
||||||
char extension[MAX_PATH];
|
char extension[MAX_PATH];
|
||||||
_splitpath(path, 0 /* drive */, 0 /* dir */, baseName, extension);
|
_splitpath_s(path,
|
||||||
|
0, /* drive */
|
||||||
|
0, /* drive length */
|
||||||
|
0, /* dir */
|
||||||
|
0, /* dir length */
|
||||||
|
baseName,
|
||||||
|
MAX_PATH, /* baseName length */
|
||||||
|
extension,
|
||||||
|
MAX_PATH /* extension length */
|
||||||
|
);
|
||||||
return std::string(baseName) + std::string(extension);
|
return std::string(baseName) + std::string(extension);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -312,7 +321,16 @@ std::string FileUtils::dirname(const char* path)
|
||||||
return dirname;
|
return dirname;
|
||||||
#else
|
#else
|
||||||
char dir[MAX_PATH];
|
char dir[MAX_PATH];
|
||||||
_splitpath(path, 0 /* drive */, dir, 0 /* filename */, 0/* extension */);
|
_splitpath_s(path,
|
||||||
|
0, /* drive */
|
||||||
|
0, /* drive length */
|
||||||
|
dir,
|
||||||
|
MAX_PATH, /* dir length */
|
||||||
|
0, /* filename */
|
||||||
|
0, /* filename length */
|
||||||
|
0, /* extension */
|
||||||
|
0 /* extension length */
|
||||||
|
);
|
||||||
return std::string(dir);
|
return std::string(dir);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue