- boinc_zip: put null arg at end of argv.

Fixes crashing bug.
    From Michael Tyka.

svn path=/trunk/boinc/; revision=17210
This commit is contained in:
David Anderson 2009-02-11 21:57:03 +00:00
parent 712e6e872a
commit 3adaa89e08
3 changed files with 14 additions and 3 deletions

View File

@ -1441,3 +1441,13 @@ David 11 Feb 2009
lib/
prefs.cpp,h
David 11 Feb 2009
- boinc_zip: put null arg at end of argv.
Fixes crashing bug.
From Michael Tyka.
zip/
boinc_zip.cpp
unzip/
unzip.c

View File

@ -99,8 +99,8 @@ int boinc_zip(int bZipType, const std::string szFileZip,
carg = 3 + nVecSize;
// make a dynamic array
av = (char**) calloc(carg, sizeof(char*));
for (i=0;i<carg;i++)
av = (char**) calloc(carg+1, sizeof(char*));
for (i=0;i<(carg+1);i++)
av[i] = (char*) calloc(_MAX_PATH,sizeof(char));
// just form an argc/argv to spoof the "main"
@ -133,7 +133,7 @@ int boinc_zip(int bZipType, const std::string szFileZip,
if (carg == 4)
sprintf(av[3], "-d%s", pvectszFileIn->at(0).c_str());
}
// strcpy(av[carg-1], ""); // null arg
strcpy(av[carg], ""); // null arg
// printf("args: %s %s %s %s\n", av[0], av[1], av[2], av[3]);
if (bZipType == ZIP_IT)

View File

@ -938,6 +938,7 @@ int unzip(__G__ argc, argv)
retcode = PK_PARAM;
goto cleanup_and_exit;
}
ctr++; // we incremented pp in the above if
}
if (firstarg) { /* ... zipfile -d exdir ... */
if (pp[1]) {