summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJasper van de Gronde <jasper.vandegronde@gmail.com>2008-03-21 08:35:54 +0000
committerjaspervdg <jaspervdg@users.sourceforge.net>2008-03-21 08:35:54 +0000
commitb802a059692479212fc44ae2a43a6be9b171dee0 (patch)
tree37781f03e1d429b3fc27b1c61f8f8ee307493951 /src/main.cpp
parentAdding axis detection to new input dialog (diff)
downloadinkscape-b802a059692479212fc44ae2a43a6be9b171dee0.tar.gz
inkscape-b802a059692479212fc44ae2a43a6be9b171dee0.zip
Replace char buffer by std::string to prevent buffer overflow when computing the new PATH.
(bzr r5141)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d86b60540..b5ed8305d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -423,7 +423,7 @@ static int _win32_set_inkscape_env(char *argv0)
CHAR szFile[_MAX_FNAME];
CHAR szExt[_MAX_EXT];
- CHAR tmp[_MAX_EXT];
+ std::string tmp;
if (GetModuleFileName(NULL, szFullPath, sizeof(szFullPath)) == 0) {
strcpy(szFullPath, argv0);
@@ -434,32 +434,32 @@ static int _win32_set_inkscape_env(char *argv0)
strcat(szFullPath, szDir);
char *oldenv = getenv("PATH");
- strcpy(tmp, "PATH=");
- strcat(tmp, szFullPath);
- strcat(tmp, ";");
- strcat(tmp, szFullPath);
- strcat(tmp, "python;");
- strcat(tmp, szFullPath);
- strcat(tmp, "perl;");
+ tmp = "PATH=";
+ tmp += szFullPath;
+ tmp += ";";
+ tmp += szFullPath;
+ tmp += "python;";
+ tmp += szFullPath;
+ tmp += "perl";
if(oldenv != NULL) {
- strcat(tmp, ";");
- strcat(tmp, oldenv);
- }
- _putenv(tmp);
+ tmp += ";";
+ tmp += oldenv;
+ }
+ _putenv(tmp.c_str());
oldenv = getenv("PYTHONPATH");
- strcpy(tmp, "PYTHONPATH=");
- strcat(tmp, szFullPath);
- strcat(tmp, "python;");
- strcat(tmp, szFullPath);
- strcat(tmp, "python\\Lib;");
- strcat(tmp, szFullPath);
- strcat(tmp, "python\\DLLs");
+ tmp = "PYTHONPATH=";
+ tmp += szFullPath;
+ tmp += "python;";
+ tmp += szFullPath;
+ tmp += "python\\Lib;";
+ tmp += szFullPath;
+ tmp += "python\\DLLs";
if(oldenv != NULL) {
- strcat(tmp, ";");
- strcat(tmp, oldenv);
- }
- _putenv(tmp);
+ tmp += ";";
+ tmp += oldenv;
+ }
+ _putenv(tmp.c_str());
return 0;
}