CVS update: /common/container/, /common/fileio/, /common/fileio/platform/mac/, /common/fileio/platform/unix/, /common/fileio/platform/win/, /common/system/, /common/util/, /common/util/platform/unix/, /common/util/platform/win/

CVS update: /common/container/, /common/fileio/, /common/fileio/platform/mac/, /common/fileio/platform/unix/, /common/fileio/platform/win/, /common/system/, /common/util/, /common/util/platform/unix/, /common/util/platform/win/

ping at helixcommunity.org ping at helixcommunity.org
Sat Dec 14 00:02:27 PST 2002


User: ping    Date: 02/12/13 16:02:27
Modified
 /common/container/
  statinfo.cpp
 /common/fileio/
  mmapmgr.cpp, mmapmgr.h
 /common/fileio/platform/mac/
  hxdir.cpp, hxdir_carbon.cpp, macff.cpp
 /common/fileio/platform/unix/
  hxdir.cpp
 /common/fileio/platform/win/
  hxdir.cpp, windir.cpp, winff.cpp
 /common/system/
  dllacces.cpp, stataccs.cpp
 /common/util/
  commreg.cpp, cookies.cpp, hxurl.cpp, portaddr.cpp, pref.cpp
 /common/util/platform/unix/
  unix_hurl.cpp
 /common/util/platform/win/
  resstr.cpp

Log
 security fixes
 Issue number:
 Obtained from:
 Submitted by:
 Reviewed by:

File Changes:

Directory: /common/container/
=============================

File [changed]: statinfo.cpp
Url: https://common.helixcommunity.org/source/browse/common/container/statinfo.cpp.diff?r1=1.2&r2=1.3
Delta lines:  +3 -2
-------------------
--- statinfo.cpp	6 Dec 2002 19:13:28 -0000	1.2
+++ statinfo.cpp	14 Dec 2002 00:02:26 -0000	1.3
@@ -40,6 +40,7 @@
 #include "hxcomm.h"
 #include "hxbuffer.h"
 #include "hxmon.h"
+#include "hxstrutl.h"
 #include "watchlst.h"
 #include "statinfo.h"
 
@@ -204,7 +205,7 @@
 	goto cleanup;
     }
 
-    strcpy(pszValue, (const char*)pValue->GetBuffer());
+    SafeStrCpy(pszValue, (const char*)pValue->GetBuffer(), MAX_DISPLAY_NAME);
    
 cleanup:
 

Directory: /common/fileio/
==========================

File [changed]: mmapmgr.cpp
Url: https://common.helixcommunity.org/source/browse/common/fileio/mmapmgr.cpp.diff?r1=1.2&r2=1.3
Delta lines:  +2 -1
-------------------
--- mmapmgr.cpp	11 Dec 2002 22:03:55 -0000	1.2
+++ mmapmgr.cpp	14 Dec 2002 00:02:26 -0000	1.3
@@ -61,6 +61,7 @@
 #endif
 
 #include "hxbuffer.h"
+#include "hxstrutl.h"
 #include "hxmap.h"
 #include "hxengin.h"
 #include "mmapmgr.h"
@@ -431,7 +432,7 @@
 	m_pDevINodeToFileInfoMap->SetAt(pLookup, pInfo = new struct _FileInfo);
 	pInfo->Descriptor = hTest;
 #endif
-	strcpy(pInfo->pKey, pLookup);
+	SafeStrCpy(pInfo->pKey, pLookup, FILEINFO_KEY_SIZE);
 	pInfo->ulSize = ulSize;
 	pInfo->pMgr = this;
 	pInfo->pMgr->AddRef();

File [changed]: mmapmgr.h
Url: https://common.helixcommunity.org/source/browse/common/fileio/mmapmgr.h.diff?r1=1.2&r2=1.3
Delta lines:  +4 -1
-------------------
--- mmapmgr.h	11 Dec 2002 22:03:55 -0000	1.2
+++ mmapmgr.h	14 Dec 2002 00:02:26 -0000	1.3
@@ -125,13 +125,16 @@
 	UINT32			    ulNumberOfPageTableEntriesInUse;
 	struct _PageTableLevel1**   pMyEntryInParentsPageTable;
     };
+
+#define FILEINFO_KEY_SIZE   32
+
     struct _FileInfo
     {
 	FILE_IDENTIFIER		    Descriptor;
 	UINT32		    	    ulSize;
 	UINT32		    	    ulRefCount;
 	UINT32		    	    ulUseCount;
-	char		    	    pKey[32];
+	char		    	    pKey[FILEINFO_KEY_SIZE];
 	MemoryMapManager*   	    pMgr;
 	struct _PageTableLevel1*    pPageTable[NUM_PTES];
 	IHXDescriptorRegistration* pDescReg;

Directory: /common/fileio/platform/mac/
=======================================

File [changed]: hxdir.cpp
Url: https://common.helixcommunity.org/source/browse/common/fileio/platform/mac/hxdir.cpp.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +7 -6
-------------------
--- hxdir.cpp	18 Oct 2002 01:43:09 -0000	1.1.1.1
+++ hxdir.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -37,6 +37,7 @@
 #include "HX_MoreProcesses.h"
 #include "pn_morefiles.h"
 #include "fullpathname.h"
+#include "hxstrutl.h"
 
 #ifndef _CARBON
 #include "morefilesextras.h"
@@ -363,7 +364,7 @@
 	    m_pPattern	    = new char[31];
 	    *m_pPattern = 0;
 	}
-	strcpy(m_pPattern, szPattern);
+	SafeStrCpy(m_pPattern, szPattern, 31);
 	
     	tempStr = m_strPath;
     	if (m_strPath.GetLength())
@@ -375,7 +376,7 @@
     	(void) FSSpecFromPathName(tempStr,&nextFSpec);
 	if (IsFolder(&nextFSpec))
 	{
-	    strcpy(szPath, (const char*)tempStr);
+	    SafeStrCpy(szPath, (const char*)tempStr, nSize);
 	    ++m_nIndex;
 	    return FSOBJ_DIRECTORY;
 	}
@@ -401,7 +402,7 @@
 	    if (noErr == ::FSMakeFSSpec(nextFSpec.vRefNum, nextFSpec.parID, nextFSpec.name, &nextFSpec))
 	    {
 	    	tempStr = nextFSpec;
-	    	strcpy(szPath, (const char*)tempStr);
+	    	SafeStrCpy(szPath, (const char*)tempStr, nSize);
 	    	return FSOBJ_FILE;
 	    }
 	}
@@ -471,7 +472,7 @@
 	    	    	tempStr += ":";
 	    	}
 	    	tempStr += m_pNextFileName;
-	    	strcpy(szPath, (const char*)tempStr);
+	    	SafeStrCpy(szPath, (const char*)tempStr, nSize);
 
 	    	if (IsFolder(&nextFSpec))
 	    	    return FSOBJ_DIRECTORY;
@@ -495,7 +496,7 @@
 
     if (m_pNextFileName)
     {
-	strcpy (m_pCurrentFileName,m_pNextFileName);
+	SafeStrCpy(m_pCurrentFileName, m_pNextFileName, nSize);
     }
     else
     {
@@ -590,7 +591,7 @@
 	    	    	tempStr += ":";
 	    	}
 		tempStr += m_pNextFileName;
-		strcpy(szPath, (const char*)tempStr);
+		SafeStrCpy(szPath, (const char*)tempStr, nSize);
 	    	if (IsFolder(&nextFSpec))
 	    	    return FSOBJ_DIRECTORY;
 	    	else

File [changed]: hxdir_carbon.cpp
Url: https://common.helixcommunity.org/source/browse/common/fileio/platform/mac/hxdir_carbon.cpp.diff?r1=1.1&r2=1.2
Delta lines:  +2 -1
-------------------
--- hxdir_carbon.cpp	23 Oct 2002 20:35:25 -0000	1.1
+++ hxdir_carbon.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -36,6 +36,7 @@
 #include "hxdir.h"
 #include "hx_morefiles.h"
 #include "fullpathname.h"
+#include "hxstrutl.h"
 
 #include "MoreFilesX.h"
 #include "filespecutils.h"
@@ -286,7 +287,7 @@
 		
 		if (nSize >= (1 + strTemp.GetLength()))
 		{
-			strcpy(szPath, (const char *) strTemp);
+		    SafeStrCpy(szPath, (const char *) strTemp, nSize);
 		}
 		
 		bIsDir = ((catInfo.nodeFlags & kFSNodeIsDirectoryMask) != 0);

File [changed]: macff.cpp
Url: https://common.helixcommunity.org/source/browse/common/fileio/platform/mac/macff.cpp.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +3 -3
-------------------
--- macff.cpp	18 Oct 2002 01:43:09 -0000	1.1.1.1
+++ macff.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -171,7 +171,7 @@
 	    {
 	    	CHXString tempStr;
 	    	tempStr = nextFSpec; // copy full path
-	    	strcpy(m_pNextFileName, (const char*)tempStr);
+	    	SafeStrCpy(m_pNextFileName, (const char*)tempStr, _MAX_PATH);
 	    	return TRUE;
 	    }
 	}
@@ -192,7 +192,7 @@
 {
     if (m_pNextFileName)
     {
-	strcpy (m_pCurrentFileName,m_pNextFileName);
+	SafeStrCpy(m_pCurrentFileName, m_pNextFileName, _MAX_PATH);
     }
     else
     {
@@ -237,7 +237,7 @@
 	    {
 	    	CHXString tempStr;
 	    	tempStr = nextFSpec; // copy full path
-	        strcpy(m_pNextFileName, (const char*)tempStr);
+	        SafeStrCpy(m_pNextFileName, (const char*)tempStr, _MAX_PATH);
 	    	bFound = TRUE;
 	    	break;
 	    }

Directory: /common/fileio/platform/unix/
========================================

File [changed]: hxdir.cpp
Url: https://common.helixcommunity.org/source/browse/common/fileio/platform/unix/hxdir.cpp.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +3 -2
-------------------
--- hxdir.cpp	18 Oct 2002 01:43:09 -0000	1.1.1.1
+++ hxdir.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -49,6 +49,7 @@
 
 #include "findfile.h"
 #include "hxdir.h"
+#include "hxstrutl.h"
 
 #include "hxheap.h"
 #ifdef _DEBUG
@@ -193,7 +194,7 @@
 
 	if (RetVal != FSOBJ_NOTVALID)
 	{
-	    strcpy(szPath, szMatchPath);
+	    SafeStrCpy(szPath, szMatchPath, nSize);
 	}
     }
 
@@ -238,7 +239,7 @@
 
 	if (RetVal != FSOBJ_NOTVALID)
 	{
-	    strcpy(szPath, szMatchPath);
+	    SafeStrCpy(szPath, szMatchPath, nSize);
 	}
     }
 

Directory: /common/fileio/platform/win/
=======================================

File [changed]: hxdir.cpp
Url: https://common.helixcommunity.org/source/browse/common/fileio/platform/win/hxdir.cpp.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +5 -4
-------------------
--- hxdir.cpp	18 Oct 2002 01:43:10 -0000	1.1.1.1
+++ hxdir.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -40,6 +40,7 @@
 #include "hlxclib/errno.h"
 #include "hlxclib/io.h"
 #include "hlxclib/sys/stat.h"
+#include "hxstrutl.h"
 #include "hxdir.h"
 #include "dbcs.h"
 
@@ -347,7 +348,7 @@
     {
         if(m_strPath.GetLength() + 1 + strlen(OS_STRING(findData.cFileName)) < nSize)
 	{
-	    strcpy(szPath, (const char*)m_strPath);
+	    SafeStrCpy(szPath, (const char*)m_strPath, nSize);
 	    pLastChar = HXGetPrevChar(szPath, szPath + strlen(szPath));
 	    if(pLastChar + 1 < szPath + strlen(szPath) || *pLastChar != '\\')
 		strcat(szPath, "\\");
@@ -364,7 +365,7 @@
     {   
         if(m_strPath.GetLength() + 1 + strlen(m_FindFileInfo.name) < nSize)
 	{
-	    strcpy(szPath, (const char*)m_strPath);
+	    SafeStrCpy(szPath, (const char*)m_strPath, nSize);
 	    if(m_strPath.GetLength() && m_strPath.GetAt(m_strPath.GetLength() - 1) != '\\')
 		strcat(szPath, "\\");
             strcat(szPath, m_FindFileInfo.name);
@@ -398,7 +399,7 @@
         {
             if(m_strPath.GetLength() + 1 + strlen(OS_STRING(findData.cFileName)) < nSize)
 	    {
-		strcpy(szPath, (const char*)m_strPath);
+		SafeStrCpy(szPath, (const char*)m_strPath, nSize);
 		const char* pLastChar = HXGetPrevChar(szPath, szPath + strlen(szPath));
 		if(pLastChar + 1 < szPath + strlen(szPath) || *pLastChar != '\\')
 		    strcat(szPath, "\\");
@@ -416,7 +417,7 @@
     {   
         if(m_strPath.GetLength() + 1 + strlen(m_FindFileInfo.name) < nSize)
 	{
-	    strcpy(szPath, (const char*)m_strPath);
+	    SafeStrCpy(szPath, (const char*)m_strPath, nSize);
 	    if(m_strPath.GetLength() && m_strPath.GetAt(m_strPath.GetLength() - 1) != '\\')
 		strcat(szPath, "\\");
             strcat(szPath, m_FindFileInfo.name);

File [changed]: windir.cpp
Url: https://common.helixcommunity.org/source/browse/common/fileio/platform/win/windir.cpp.diff?r1=1.2&r2=1.3
Delta lines:  +1 -1
-------------------
--- windir.cpp	6 Dec 2002 06:05:44 -0000	1.2
+++ windir.cpp	14 Dec 2002 00:02:26 -0000	1.3
@@ -64,7 +64,7 @@
 {
     char new_path[_MAX_PATH+10];
 
-    sprintf(new_path, "%s\\*.*", _path);
+    SafeSprintf(new_path, _MAX_PATH+10, "%s\\*.*", _path);
     
     _file_handle = FindFirstFile(OS_STRING(new_path), &_file_info);
 

File [changed]: winff.cpp
Url: https://common.helixcommunity.org/source/browse/common/fileio/platform/win/winff.cpp.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +7 -6
-------------------
--- winff.cpp	18 Oct 2002 01:43:10 -0000	1.1.1.1
+++ winff.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -46,6 +46,7 @@
 #include <ctype.h>
 
 #include "hxresult.h"
+#include "hxstrutl.h"
 #include "findfile.h"
 #include "platform/win/winff.h"
 
@@ -168,9 +169,9 @@
 	}
 
 #ifndef WIN32_PLATFORM_PSPC
-	strcpy(m_pNextFileName, m_FileInfo.name);
+	SafeStrCpy(m_pNextFileName, m_FileInfo.name, _MAX_PATH);
 #else
-	strcpy(m_pNextFileName, OS_STRING(m_FileInfo.cFileName));
+	SafeStrCpy(m_pNextFileName, Unicode(m_FileInfo.cFileName), _MAX_PATH);
 #endif
 	return TRUE;
     }
@@ -181,7 +182,7 @@
 #else
     if (!_dos_findfirst( m_pCurrentDirectory, _A_ARCH | _A_HIDDEN | _A_NORMAL | _A_RDONLY, &m_FileInfo))
     {
-	strcpy(m_pNextFileName, m_FileInfo.name);
+	SafeStrCpy(m_pNextFileName, m_FileInfo.name, _MAX_PATH);
 	return TRUE;
     }
     else
@@ -199,7 +200,7 @@
 {
     if (m_pNextFileName)
     {
-	strcpy (m_pCurrentFileName,m_pNextFileName);
+	SafeStrCpy(m_pCurrentFileName, m_pNextFileName, _MAX_PATH);
     }
     else
     {
@@ -221,9 +222,9 @@
 #endif
 	{
 #ifndef WIN32_PLATFORM_PSPC
-	strcpy(m_pNextFileName, m_FileInfo.name);
+	SafeStrCpy(m_pNextFileName, m_FileInfo.name, _MAX_PATH);
 #else
-	strcpy(m_pNextFileName, OS_STRING(m_FileInfo.cFileName));
+	SafeStrCpy(m_pNextFileName, OS_STRING(m_FileInfo.cFileName), _MAX_PATH);
 #endif
 	}
 	else

Directory: /common/system/
==========================

File [changed]: dllacces.cpp
Url: https://common.helixcommunity.org/source/browse/common/system/dllacces.cpp.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +10 -10
---------------------
--- dllacces.cpp	18 Oct 2002 01:45:09 -0000	1.1.1.1
+++ dllacces.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -565,7 +565,7 @@
     char* libSearchPaths = getenv("LD_LIBRARY_PATH");
     if(libSearchPaths)
     {
-	strcpy(tmpPaths, libSearchPaths);
+	SafeStrCpy(tmpPaths, libSearchPaths, MAXPATHLEN);
 	strcat(tmpPaths, ";");
     }
     strcat(tmpPaths, "/usr/lib;/lib");
@@ -577,9 +577,9 @@
         char realPath[MAXPATHLEN+1];  // resolved path
 
         // lstat dirName/libName to get final inode
-        strcpy(pathName, dirName);
-        strcat(pathName, "/");
-        strcat(pathName, libName);
+        SafeStrCpy(pathName, dirName, MAXPATHLEN);
+        SafeStrCat(pathName, "/", MAXPATHLEN);
+        SafeStrCat(pathName, libName, MAXPATHLEN);
 
         while(lstat(pathName, &buf) == 0)
         {
@@ -591,24 +591,24 @@
                 {
                     if(path[0] == '.')  // relative path
                     {
-                        strcpy(realPath, dirName);
+                        SafeStrCpy(realPath, dirName, MAXPATHLEN);
                         strcat(realPath, "/");
-                        strcat(realPath, path);
+                        SafeStrCat(realPath, path, MAXPATHLEN+1);
                     }
                     else
-                        strcpy(realPath, path);
+                        SafeStrCpy(realPath, path, MAXPATHLEN+1);
                     break;
                 }
                 // next dir
                 path[linklen] = '\0';
-                strcpy(pathName, dirName);
+                SafeStrCpy(pathName, dirName, MAXPATHLEN);
                 strcat(pathName, "/");
-                strcat(pathName, path);
+                SafeStrCat(pathName, path, MAXPATHLEN+1);
             }
             else	// this is the actual filename
             {
 		char path[MAXPATHLEN+1];
-                strcpy(realPath, pathName);
+                SafeStrCpy(realPath, pathName, MAXPATHLEN+1);
                 if(realpath(realPath, path))
 		{
 		    // now, finally, get version from actual file name

File [changed]: stataccs.cpp
Url: https://common.helixcommunity.org/source/browse/common/system/stataccs.cpp.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +2 -2
-------------------
--- stataccs.cpp	18 Oct 2002 01:45:09 -0000	1.1.1.1
+++ stataccs.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -143,7 +143,7 @@
     }
     if (!found) {
         char errMsg[256];
-	sprintf(errMsg, "Application not linked against module %s", m_dllName);
+	SafeSprintf(errMsg, 256, "Application not linked against module %s", m_dllName);
 	setErrorString(errMsg);
 #if defined(_DEBUG) && defined(DLLACCESS_VERBOSE)
 	fprintf(stderr, "%s\n", errMsg);
@@ -251,7 +251,7 @@
 
     out_buf[0] = 0;
 
-    strcpy(out_buf, long_name);
+    SafeStrCpy(out_buf, long_name, out_buf_len);
 }
 
 

Directory: /common/util/
========================

File [changed]: commreg.cpp
Url: https://common.helixcommunity.org/source/browse/common/util/commreg.cpp.diff?r1=1.2&r2=1.3
Delta lines:  +5 -4
-------------------
--- commreg.cpp	11 Dec 2002 22:07:17 -0000	1.2
+++ commreg.cpp	14 Dec 2002 00:02:26 -0000	1.3
@@ -42,6 +42,7 @@
 #include "debug.h"
 #include "ihxpckts.h"
 #include "hxmon.h"
+#include "hxstrutl.h"
 #include "chxpckts.h"
 #include "db_misc.h"
 #include "key.h"
@@ -1808,13 +1809,13 @@
 	}
 	if (HXR_OK == pValues->GetFirstPropertyULONG32(pName, ul))
 	{
-	    strcpy(buf, pTo);
-	    strcat(buf, pName + strlen(pFrom));
+	    SafeStrCpy(buf, pTo, 256);
+	    SafeStrCat(buf, pName + strlen(pFrom), 256);
 	    res = Copy(pName, buf);
 	    while (HXR_OK == pValues->GetNextPropertyULONG32(pName, ul))
 	    {
-		strcpy(buf, pTo);
-		strcat(buf, pName + strlen(pFrom));
+		SafeStrCpy(buf, pTo, 256);
+		SafeStrCat(buf, pName + strlen(pFrom), 256);
 		res = Copy(pName, buf);
 	    }
 	}

File [changed]: cookies.cpp
Url: https://common.helixcommunity.org/source/browse/common/util/cookies.cpp.diff?r1=1.3&r2=1.4
Delta lines:  +2 -2
-------------------
--- cookies.cpp	11 Dec 2002 22:07:17 -0000	1.3
+++ cookies.cpp	14 Dec 2002 00:02:26 -0000	1.4
@@ -940,7 +940,7 @@
 
 	if (RegQueryValueEx(hBiffKey, OS_STRING("CurrentUser"), 0, &ulType, (LPBYTE)pUser, &ulSize) == ERROR_SUCCESS) 
 	{
-	    sprintf(regKey, "Software\\Netscape\\Netscape Navigator\\biff\\users\\%s", pUser);
+	    SafeSprintf(regKey, _MAX_PATH, "Software\\Netscape\\Netscape Navigator\\biff\\users\\%s", pUser);
 	    
 	    if (RegOpenKeyEx(HKEY_CURRENT_USER, OS_STRING(regKey), 0, KEY_READ, &hUsersKey) == ERROR_SUCCESS)
 	    {
@@ -950,7 +950,7 @@
 		ulSize = _MAX_PATH - 1;
 		if (RegQueryValueEx(hUsersKey, OS_STRING("defaultServer"), 0, &ulType, (LPBYTE)pValue, &ulSize) == ERROR_SUCCESS)
 		{
-		    sprintf(regKey, "Software\\Netscape\\Netscape Navigator\\biff\\users\\%s\\servers\\%s",
+		    SafeSprintf(regKey, _MAX_PATH, "Software\\Netscape\\Netscape Navigator\\biff\\users\\%s\\servers\\%s",
 			    pUser, pValue);
 
 		    if (RegOpenKeyEx(HKEY_CURRENT_USER, OS_STRING(regKey), 0, KEY_READ, &hServersKey) == ERROR_SUCCESS)

File [changed]: hxurl.cpp
Url: https://common.helixcommunity.org/source/browse/common/util/hxurl.cpp.diff?r1=1.3&r2=1.4
Delta lines:  +11 -10
---------------------
--- hxurl.cpp	11 Dec 2002 22:07:17 -0000	1.3
+++ hxurl.cpp	14 Dec 2002 00:02:26 -0000	1.4
@@ -780,7 +780,7 @@
     {	    
 	// allocate mem. for m_pszAltURL
 	pAltURL = new char[pValue->GetSize()];
-	strcpy(pAltURL, (const char*)pValue->GetBuffer());
+	SafeStrCpy(pAltURL, (const char*)pValue->GetBuffer(), pValue->GetSize());
     }
     else if (HXR_OK == m_pProperties->GetPropertyBuffer("url", pValue) && pValue)
     {	
@@ -792,18 +792,19 @@
 	    // The +1 is NOT for the NULL terminator since the size already has space for it.  The +1 is actually because
 	    // if the URL contains a pnm:// the code below will potentially add a http:// which is one more character than
 	    // a pnm URL.  A rtsp:// URL will work correctly 
-	    pAltURL = new char[pValue->GetSize()+1];
-	    memset(pAltURL, 0, pValue->GetSize()+1);
+            INT32 lSize = pValue->GetSize() + 1;
+	    pAltURL = new char[lSize];
+	    memset(pAltURL, 0, lSize);
 
 	    pURL = (char*)pValue->GetBuffer();
 	    
 	    switch (m_unProtocol)
 	    {
 	    case pnmProtocol:				
-		sprintf(pAltURL, "http:%s", pURL + 4);
+		SafeSprintf(pAltURL, lSize, "http:%s", pURL + 4);
 		break;
 	    case rtspProtocol:		
-		sprintf(pAltURL, "http:%s", pURL + 5);
+		SafeSprintf(pAltURL, lSize, "http:%s", pURL + 5);
 		break;
 	    default:
 		break;
@@ -817,7 +818,7 @@
 		pCursor--;
 		*pCursor = '\0';
 
-		sprintf(pAltURL, "%s%s", pAltURL, pCursor += (strlen(m_pszPort) + 1));	
+		SafeSprintf(pAltURL, lSize, "%s%s", pAltURL, pCursor += (strlen(m_pszPort) + 1));	
 	    }
 	}
     }
@@ -1105,18 +1106,18 @@
     while (pNewList->GetCount() > 0)
     {
 	pToken = (char*) pNewList->RemoveTail();	
-	::strcat(pCompressURL, (const char*) pToken);
+	SafeStrCat(pCompressURL, (const char*) pToken, ulURLLength);
 
 	if (!pNewList->IsEmpty())
 	{
-	    ::strcat(pCompressURL, "/");
+	    SafeStrCat(pCompressURL, "/", ulURLLength);
 	}
     }
 
     if (pOptions)
     {
-	::strcat(pCompressURL, "?");
-	::strcat(pCompressURL, (const char*) (pOptions+1));
+	SafeStrCat(pCompressURL, "?", ulURLLength);
+	SafeStrCat(pCompressURL, (const char*) (pOptions+1), ulURLLength);
     }
 
 exit:

File [changed]: portaddr.cpp
Url: https://common.helixcommunity.org/source/browse/common/util/portaddr.cpp.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +1 -1
-------------------
--- portaddr.cpp	18 Oct 2002 01:45:52 -0000	1.1.1.1
+++ portaddr.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -166,7 +166,7 @@
 
     // collect the # of entries with/without wildcard
     pszValue = new char[pValue->GetSize() + 1];
-    strcpy(pszValue, (char*)pValue->GetBuffer());
+    SafeStrCpy(pszValue, (char*)pValue->GetBuffer(), pValue->GetSize());
 
     pszToken = strtok(pszValue, ",\n");
     while (pszToken)

File [changed]: pref.cpp
Url: https://common.helixcommunity.org/source/browse/common/util/pref.cpp.diff?r1=1.4&r2=1.5
Delta lines:  +2 -1
-------------------
--- pref.cpp	11 Dec 2002 22:07:17 -0000	1.4
+++ pref.cpp	14 Dec 2002 00:02:26 -0000	1.5
@@ -42,6 +42,7 @@
 #include "hxassert.h"
 #include "hxbuffer.h"
 #include "hxstring.h"
+#include "hxstrutl.h"
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -214,7 +215,7 @@
     char	szBufferCopy[MAX_PREF_SIZE];
     char*	pToken= NULL;
     
-    strcpy(szBufferCopy,pBuffer);
+    SafeStrCpy(szBufferCopy, pBuffer, MAX_PREF_SIZE);
 
    // Establish string and get the first token: 
    pToken = strtok( szBufferCopy, szSeperators );

Directory: /common/util/platform/unix/
======================================

File [changed]: unix_hurl.cpp
Url: https://common.helixcommunity.org/source/browse/common/util/platform/unix/unix_hurl.cpp.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +2 -1
-------------------
--- unix_hurl.cpp	18 Oct 2002 01:45:53 -0000	1.1.1.1
+++ unix_hurl.cpp	14 Dec 2002 00:02:26 -0000	1.2
@@ -47,6 +47,7 @@
 #include <stdio.h>
 
 #include "hxassert.h"
+#include "hxstrutl.h"
 #include "unix_hurl.h"
 
 #include "cunixprefutils.h"
@@ -153,7 +154,7 @@
             }
             else
             {
-                strcpy(g_pURL, szURL);
+                SafeStrCpy(g_pURL, szURL, MAX_URL_LEN);
                 signal(SIGCHLD, browse_child);
             }
 

Directory: /common/util/platform/win/
=====================================

File [changed]: resstr.cpp
Url: https://common.helixcommunity.org/source/browse/common/util/platform/win/resstr.cpp.diff?r1=1.2&r2=1.3
Delta lines:  +3 -3
-------------------
--- resstr.cpp	4 Nov 2002 22:34:02 -0000	1.2
+++ resstr.cpp	14 Dec 2002 00:02:26 -0000	1.3
@@ -36,7 +36,7 @@
 #include "hxcom.h"
 #include "hxassert.h"
 #include "ResStr.h"
-
+#include "hxstrutl.h"
 #include "hxmullan.h"		// Multipl-Language Support API
 #include "hxheap.h"
 #ifdef _DEBUG
@@ -96,7 +96,7 @@
 	//	This is a deep copy, so we duplicate the character data
 	if (m_pcString)
 	{
-		strcpy( m_pcString, theRes.m_pcString );
+	    SafeStrCpy( m_pcString, theRes.m_pcString, m_iLen+1 );
 	}
 }
 
@@ -145,7 +145,7 @@
 	m_iLen = theRes.m_iLen;
 	m_iResNum = theRes.m_iResNum;
 	m_pcString = pcBuffer;
-	strcpy( m_pcString, theRes.m_pcString );
+	SafeStrCpy( m_pcString, theRes.m_pcString, m_iLen+1 );
 	return( *this );
 }
 




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at common.helixcommunity.org
For additional commands, e-mail: cvs-help at common.helixcommunity.org




More information about the Common-cvs mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.