Changeset 75469 in vbox for trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
- Timestamp:
- Nov 14, 2018 8:53:20 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 126624
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
r75467 r75469 23 23 #include <iprt/cpp/autores.h> 24 24 #include <iprt/buildconfig.h> 25 #include <iprt/ctype.h> 26 #include <iprt/err.h> 25 27 #include <iprt/getopt.h> 26 28 #include <iprt/initterm.h> … … 43 45 # include <VBox/shflsvc.h> 44 46 # ifdef RT_OS_OS2 47 # define OS2EMX_PLAIN_CHAR 45 48 # define INCL_ERRORS 46 49 # define INCL_DOSFILEMGR … … 1704 1707 return VBoxControlSyntaxError("sharedfolders use: not a drive letter: %s\n", pszDrive); 1705 1708 1709 static const char s_szTag[] = "VBoxControl"; 1710 char szzNameAndTag[256]; 1706 1711 const char *pszName = argv[1]; 1707 1712 size_t cchName = strlen(pszName); 1708 1713 if (cchName < 1) 1709 1714 return VBoxControlSyntaxError("sharedfolders use: shared folder name cannot be empty!\n"); 1710 if (cchName > 128)1715 if (cchName + 1 + sizeof(s_szTag) >= sizeof(szzNameAndTag)) 1711 1716 return VBoxControlSyntaxError("sharedfolders use: shared folder name is too long! (%s)\n", pszName); 1712 1717 … … 1714 1719 * Do the attaching. 1715 1720 */ 1716 static const char s_szTag[] = "VBoxControl"; 1717 char szzNameAndTag[256]; 1718 size_t cchName = strlen(pEntry->pszName); 1719 memcpy(szzNameAndTag, pEntry->pszName, cchName); 1721 memcpy(szzNameAndTag, pszName, cchName); 1720 1722 szzNameAndTag[cchName] = '\0'; 1721 1723 memcpy(&szzNameAndTag[cchName + 1], s_szTag, sizeof(s_szTag)); 1722 1724 1723 APIRET rc = DosFSAttach(pEntry->pszActualMountPoint, "VBOXSF", szzNameAndTag, cchName + 1 + sizeof(s_szTag), FS_ATTACH);1724 if (rc == NO_ERROR)1725 APIRET rcOs2 = DosFSAttach(pszDrive, "VBOXSF", szzNameAndTag, cchName + 1 + sizeof(s_szTag), FS_ATTACH); 1726 if (rcOs2 == NO_ERROR) 1725 1727 return RTEXITCODE_SUCCESS; 1726 1728 return VBoxControlError("DosFSAttach/FS_ATTACH failed to attach '%s' to '%s': %u\n", pszName, pszDrive, rcOs2);
Note:
See TracChangeset
for help on using the changeset viewer.