BOOL Config_ContactGateway (LPTSTR pszGateway, LPTSTR pszCell)
{
+ // pszCell is MAX_PATH
BOOL rc = FALSE;
BYTE OutData[ PIOCTL_MAXSIZE ];
ULONG status;
if ((status = pioctl (0, VIOC_GET_WS_CELL, &IOInfo, 1)) == 0)
- {
- if (OutData[0])
- {
- lstrcpy (pszCell, (LPCTSTR)OutData);
- rc = TRUE;
- }
- }
+ {
+ OutData[min(PIOCTL_MAXSIZE, MAX_PATH) - 1] = '\0';
+ if (OutData[0])
+ {
+ lstrcpy (pszCell, (LPCTSTR)OutData);
+ rc = TRUE;
+ }
+ }
Config_SetGatewayName (szOldGateway);
}
+
BOOL PathToSubmount (LPTSTR pszSubmount, LPTSTR pszMapping, LPTSTR pszSubmountReq, ULONG *pStatus)
{
+ // pszSubmount is MAX_PATH in length
+
if (pszSubmountReq && !IsValidSubmountName (pszSubmountReq))
pszSubmountReq = NULL;
if (status)
return FALSE;
+
+ OutData[min(PIOCTL_MAXSIZE, MAX_PATH) - 1] = '\0';
lstrcpy (pszSubmount, (LPCTSTR)OutData);
return (pszSubmount[0] != TEXT('\0')) ? TRUE : FALSE;
}
DWORD MountDOSDrive(char chDrive,const char *szSubmount,BOOL bPersistent,const char * pUsername)
{
+#ifdef AFSIFS
DWORD err;
- BOOL succ;
- TCHAR szPath[MAX_PATH], szTokens[MAX_PATH], *tok;
+ BOOL succ;
+ TCHAR szTokens[MAX_PATH], *tok;
+#endif /* AFSIFS */
+ TCHAR szPath[MAX_PATH];
TCHAR szClient[MAX_PATH];
TCHAR szDrive[3] = TEXT("?:");
DWORD DisMountDOSDrive(const char chDrive,BOOL bForce)
{
TCHAR szPath[MAX_PATH];
+#ifdef AFSIFS
DWORD succ;
-
+#endif
sprintf(szPath,"%c:",chDrive);
#ifdef AFSIFS
succ = DefineDosDevice(DDD_REMOVE_DEFINITION, szPath, NULL);
} else
results.Add(GetAfsError(errno));
} else {
+ space[MAXSIZE - 1] = '\0';
results.Add(Utf8ToCString(space));
}
}
last_component.ReleaseBuffer();
if (code == 0) {
- int nPos = strlen(space) - 1;
+ int nPos;
+ space[MAXSIZE - 1] = '\0';
+ nPos = strlen(space) - 1;
if (space[nPos] == '.')
space[nPos] = 0;
mountPoints.Add(ParseMountPoint(StripPath(files[i]), Utf8ToCString(space)));
blob.out = space;
code = pioctl_T(strFile, VIOCGETVOLSTAT, &blob, 1);
- if (code) {
+ if (code || blob.out_size < sizeof(*status)) {
volInfo.m_strErrorMsg = GetAfsError(errno, strFile);
return FALSE;
}
#endif
code = pioctl_T(volInfo.m_strFilePath, VIOCSETVOLSTAT, &blob, 1);
- if (code) {
+ if (code || blob.out_size < sizeof(*status)) {
ShowMessageBox(IDS_SET_QUOTA_ERROR, MB_ICONERROR, IDS_SET_QUOTA_ERROR, GetAfsError(errno, volInfo.m_strName));
return FALSE;
}
ustrLast.ReleaseBuffer();
if (code == 0) {
- CString syml = Utf8ToCString(space);
- int len = syml.GetLength();
+ CString syml;
+ int len;
+
+ space[MAXSIZE - 1] = '\0';
+ syml = Utf8ToCString(space);
+ len = syml.GetLength();
if (len > 0) {
if (syml[len - 1] == _T('.'))