Changeset 67757 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Jul 3, 2017 1:52:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/adpctl/VBoxNetAdpCtl.cpp
r67687 r67757 320 320 } 321 321 } 322 pszBuffer = new char[strlen(pcszAddress) + 4]; // '/xx\0' 323 sprintf(pszBuffer, "%s/%u", pcszAddress, cBits); 322 const size_t cbBuf = strlen(pcszAddress) + 4; 323 pszBuffer = new char[cbBuf]; // '/xx\0' 324 snprintf(pszBuffer, cbBuf, "%s/%u", pcszAddress, cBits); 324 325 return pszBuffer; 325 326 } … … 486 487 int add(char *pszNameInOut); 487 488 int remove(const char *pcszName); 488 int checkName(const char *pcszNameIn, char *pszNameOut );489 int checkName(const char *pcszNameIn, char *pszNameOut, size_t cbNameOut); 489 490 protected: 490 491 virtual int doIOCtl(unsigned long iCmd, VBOXNETADPREQ *pReq); … … 588 589 } 589 590 590 int Adapter::checkName(const char *pcszNameIn, char *pszNameOut )591 int Adapter::checkName(const char *pcszNameIn, char *pszNameOut, size_t cbNameOut) 591 592 { 592 593 int iAdapterIndex = -1; … … 599 600 return ADPCTLERR_BAD_NAME; 600 601 } 601 s printf(pszNameOut, "vboxnet%d", iAdapterIndex);602 snprintf(pszNameOut, cbNameOut, "vboxnet%d", iAdapterIndex); 602 603 if (strcmp(pszNameOut, pcszNameIn)) 603 604 { … … 702 703 } 703 704 #endif 704 705 rc = g_adapter.checkName(argv[1], szAdapterName );705 706 rc = g_adapter.checkName(argv[1], szAdapterName, sizeof(szAdapterName)); 706 707 if (rc) 707 708 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.