aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/mac_updater/mac_updater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/mac_updater/mac_updater.cpp')
-rw-r--r--linden/indra/mac_updater/mac_updater.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/linden/indra/mac_updater/mac_updater.cpp b/linden/indra/mac_updater/mac_updater.cpp
index 25399c5..72cd4c4 100644
--- a/linden/indra/mac_updater/mac_updater.cpp
+++ b/linden/indra/mac_updater/mac_updater.cpp
@@ -12,12 +12,12 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2 15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 * 16 *
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception 20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 21 *
22 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -496,14 +496,13 @@ bool isDirWritable(FSRef &dir)
496 // This is kinda lame, but will pretty much always give the right answer. 496 // This is kinda lame, but will pretty much always give the right answer.
497 497
498 OSStatus err = noErr; 498 OSStatus err = noErr;
499 char temp[PATH_MAX]; /* Flawfinder: ignore */ 499 char temp[PATH_MAX] = ""; /* Flawfinder: ignore */
500 500
501 err = FSRefMakePath(&dir, (UInt8*)temp, sizeof(temp)); 501 err = FSRefMakePath(&dir, (UInt8*)temp, sizeof(temp));
502 502
503 if(err == noErr) 503 if(err == noErr)
504 { 504 {
505 temp[0] = '\0'; 505 strncat(temp, "/.test_XXXXXX", (sizeof(temp) - strlen(temp)) - 1);
506 strncat(temp, "/.test_XXXXXX", sizeof(temp) - 1);
507 506
508 if(mkdtemp(temp) != NULL) 507 if(mkdtemp(temp) != NULL)
509 { 508 {
@@ -557,8 +556,8 @@ static std::string HFSUniStr255_to_utf8str(const HFSUniStr255* src)
557 556
558int restoreObject(const char* aside, const char* target, const char* path, const char* object) 557int restoreObject(const char* aside, const char* target, const char* path, const char* object)
559{ 558{
560 char source[PATH_MAX]; /* Flawfinder: ignore */ 559 char source[PATH_MAX] = ""; /* Flawfinder: ignore */
561 char dest[PATH_MAX]; /* Flawfinder: ignore */ 560 char dest[PATH_MAX] = ""; /* Flawfinder: ignore */
562 snprintf(source, sizeof(source), "%s/%s/%s", aside, path, object); 561 snprintf(source, sizeof(source), "%s/%s/%s", aside, path, object);
563 snprintf(dest, sizeof(dest), "%s/%s", target, path); 562 snprintf(dest, sizeof(dest), "%s/%s", target, path);
564 FSRef sourceRef; 563 FSRef sourceRef;
@@ -592,7 +591,7 @@ int restoreObject(const char* aside, const char* target, const char* path, const
592// Replace any mention of "Second Life" with the product name. 591// Replace any mention of "Second Life" with the product name.
593void filterFile(const char* filename) 592void filterFile(const char* filename)
594{ 593{
595 char temp[PATH_MAX]; /* Flawfinder: ignore */ 594 char temp[PATH_MAX] = ""; /* Flawfinder: ignore */
596 // First copy the target's version, so we can run it through sed. 595 // First copy the target's version, so we can run it through sed.
597 snprintf(temp, sizeof(temp), "cp '%s' '%s.tmp'", filename, filename); 596 snprintf(temp, sizeof(temp), "cp '%s' '%s.tmp'", filename, filename);
598 system(temp); /* Flawfinder: ignore */ 597 system(temp); /* Flawfinder: ignore */
@@ -724,13 +723,13 @@ void *updatethreadproc(void*)
724{ 723{
725 char tempDir[PATH_MAX] = ""; /* Flawfinder: ignore */ 724 char tempDir[PATH_MAX] = ""; /* Flawfinder: ignore */
726 FSRef tempDirRef; 725 FSRef tempDirRef;
727 char temp[PATH_MAX]; /* Flawfinder: ignore */ 726 char temp[PATH_MAX] = ""; /* Flawfinder: ignore */
728 // *NOTE: This buffer length is used in a scanf() below. 727 // *NOTE: This buffer length is used in a scanf() below.
729 char deviceNode[1024] = ""; /* Flawfinder: ignore */ 728 char deviceNode[1024] = ""; /* Flawfinder: ignore */
730 FILE *downloadFile = NULL; 729 FILE *downloadFile = NULL;
731 OSStatus err; 730 OSStatus err;
732 ProcessSerialNumber psn; 731 ProcessSerialNumber psn;
733 char target[PATH_MAX]; /* Flawfinder: ignore */ 732 char target[PATH_MAX] = ""; /* Flawfinder: ignore */
734 FSRef targetRef; 733 FSRef targetRef;
735 FSRef targetParentRef; 734 FSRef targetParentRef;
736 FSVolumeRefNum targetVol; 735 FSVolumeRefNum targetVol;
@@ -907,14 +906,14 @@ void *updatethreadproc(void*)
907 if(err != noErr) 906 if(err != noErr)
908 throw 0; 907 throw 0;
909 908
910 temp[0] = '\0'; 909 strncat(temp, "/SecondLifeUpdate_XXXXXX", (sizeof(temp) - strlen(temp)) - 1);
911 strncat(temp, "/SecondLifeUpdate_XXXXXX", sizeof(temp) - 1);
912 if(mkdtemp(temp) == NULL) 910 if(mkdtemp(temp) == NULL)
913 { 911 {
914 throw 0; 912 throw 0;
915 } 913 }
916 914
917 strcpy(tempDir, temp); /* Flawfinder: ignore */ 915 strncpy(tempDir, temp, sizeof(tempDir));
916 temp[sizeof(tempDir) - 1] = '\0';
918 917
919 llinfos << "tempDir is " << tempDir << llendl; 918 llinfos << "tempDir is " << tempDir << llendl;
920 919