From 3adaa89e083f40f73981f3afa575f8169f26a06e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 11 Feb 2009 21:57:03 +0000 Subject: [PATCH] - boinc_zip: put null arg at end of argv. Fixes crashing bug. From Michael Tyka. svn path=/trunk/boinc/; revision=17210 --- checkin_notes | 10 ++++++++++ zip/boinc_zip.cpp | 6 +++--- zip/unzip/unzip.c | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/checkin_notes b/checkin_notes index 1a5cb021a8..62a4ba8523 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/zip/boinc_zip.cpp b/zip/boinc_zip.cpp index 2c3480b3cc..d47765b55f 100644 --- a/zip/boinc_zip.cpp +++ b/zip/boinc_zip.cpp @@ -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;iat(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) diff --git a/zip/unzip/unzip.c b/zip/unzip/unzip.c index 651abb24ea..b8ccb4c972 100644 --- a/zip/unzip/unzip.c +++ b/zip/unzip/unzip.c @@ -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]) {