use strschg_environ() with control length of string

This commit is contained in:
Stas Degteff 2011-02-17 22:59:54 +00:00
parent d0ea4b0d6c
commit b7e669bf1e
2 changed files with 6 additions and 5 deletions

View File

@ -224,8 +224,9 @@ void WipeFile(const char* file, int options);
const char* CleanFilename(const char* __file);
// DOS-style enviroment variables substitution in string.
int strschg_environ(char* s);
int strschg_environ(std::string& s);
int strschg_environ(char* s); /* Possible buffer owerflow! Please use another variant. */
int strschg_environ(char* s, size_t s_size); /* With control buffer size */
int strschg_environ(std::string& s); /* Use dinamic allocated string. */
char* MapPath(char* map, bool reverse = false); // gcarea.cpp
inline char* ReMapPath(char* map) { return MapPath(map, true); }

View File

@ -237,8 +237,8 @@ void MakePathname(char* pathname, const char* path, const char* name) {
if( (pathname == NULL) or (path == NULL) or (name == NULL) ) return;
strxcpy(tmpname, name, GMAXPATH);
strschg_environ(tmpname);
strxcpy(tmpname, name, sizeof(tmpname));
strschg_environ(tmpname, sizeof(tmpname));
if(strblank(tmpname)) {
*pathname = NUL;
@ -352,7 +352,7 @@ void TouchFile(const TCHAR *filename)
char* PathCopy(char* __dst, const char* __src) {
if( (__dst == NULL) or (__src == NULL) ) return __dst;
strschg_environ(strxcpy(__dst, __src, sizeof(Path)));
strschg_environ(strxcpy(__dst, __src, sizeof(Path)), sizeof(Path));
return AddBackslash(__dst);
}