Changeset 49113 in vbox for trunk/src/VBox/NetworkServices
- Timestamp:
- Oct 15, 2013 9:36:22 AM (11 years ago)
- Location:
- trunk/src/VBox/NetworkServices
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
r49063 r49113 399 399 for (i = 0; i < count_strs; ++i) 400 400 { 401 char aszAddr[17];401 char szAddr[17]; 402 402 RTNETADDRIPV4 ip4addr; 403 403 char *pszTerm; … … 406 406 const char *pszLo2Off = strLo2Off.c_str(); 407 407 408 RT_ZERO( aszAddr);408 RT_ZERO(szAddr); 409 409 410 410 pszTerm = RTStrStr(pszLo2Off, "="); … … 413 413 && (pszTerm - pszLo2Off) <= INET_ADDRSTRLEN) 414 414 { 415 memcpy( aszAddr, pszLo2Off, (pszTerm - pszLo2Off));416 int rc = RTNetStrToIPv4Addr( aszAddr, &ip4addr);415 memcpy(szAddr, pszLo2Off, (pszTerm - pszLo2Off)); 416 int rc = RTNetStrToIPv4Addr(szAddr, &ip4addr); 417 417 if (RT_SUCCESS(rc)) 418 418 { -
trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
r49112 r49113 295 295 RT_ZERO(r); 296 296 297 if (name.length() > RT_ELEMENTS(r.Pfr.aszPfrName))297 if (name.length() > sizeof(r.Pfr.szPfrName)) 298 298 { 299 299 hrc = E_INVALIDARG; … … 314 314 315 315 316 RTStrPrintf(r.Pfr.aszPfrName, RT_ELEMENTS(r.Pfr.aszPfrName), 317 "%s", 318 com::Utf8Str(name).c_str()); 319 320 RTStrPrintf(r.Pfr.aszPfrHostAddr, RT_ELEMENTS(r.Pfr.aszPfrHostAddr), 321 "%s", 322 com::Utf8Str(strHostAddr).c_str()); 316 RTStrPrintf(r.Pfr.szPfrName, sizeof(r.Pfr.szPfrName), 317 "%s", com::Utf8Str(name).c_str()); 318 319 RTStrPrintf(r.Pfr.szPfrHostAddr, sizeof(r.Pfr.szPfrHostAddr), 320 "%s", com::Utf8Str(strHostAddr).c_str()); 323 321 324 322 /* XXX: limits should be checked */ 325 323 r.Pfr.u16PfrHostPort = (uint16_t)lHostPort; 326 324 327 RTStrPrintf(r.Pfr.aszPfrGuestAddr, RT_ELEMENTS(r.Pfr.aszPfrGuestAddr), 328 "%s", 329 com::Utf8Str(strGuestAddr).c_str()); 325 RTStrPrintf(r.Pfr.szPfrGuestAddr, sizeof(r.Pfr.szPfrGuestAddr), 326 "%s", com::Utf8Str(strGuestAddr).c_str()); 330 327 331 328 /* XXX: limits should be checked */ … … 347 344 if ( natFw.Pfr.iPfrProto == r.Pfr.iPfrProto 348 345 && natFw.Pfr.u16PfrHostPort == r.Pfr.u16PfrHostPort 349 && (strncmp(natFw.Pfr. aszPfrHostAddr, r.Pfr.aszPfrHostAddr, INET6_ADDRSTRLEN) == 0)346 && (strncmp(natFw.Pfr.szPfrHostAddr, r.Pfr.szPfrHostAddr, INET6_ADDRSTRLEN) == 0) 350 347 && natFw.Pfr.u16PfrGuestPort == r.Pfr.u16PfrGuestPort 351 && (strncmp(natFw.Pfr. aszPfrGuestAddr, r.Pfr.aszPfrGuestAddr, INET6_ADDRSTRLEN) == 0))348 && (strncmp(natFw.Pfr.szPfrGuestAddr, r.Pfr.szPfrGuestAddr, INET6_ADDRSTRLEN) == 0)) 352 349 { 353 350 fwspec *pFwCopy = (fwspec *)RTMemAllocZ(sizeof(fwspec)); … … 815 812 } 816 813 817 pszHostAddr = natPf.Pfr. aszPfrHostAddr;814 pszHostAddr = natPf.Pfr.szPfrHostAddr; 818 815 819 816 /* XXX: workaround for inet_pton and an empty ipv4 address … … 830 827 pszHostAddr, 831 828 natPf.Pfr.u16PfrHostPort, 832 natPf.Pfr. aszPfrGuestAddr,829 natPf.Pfr.szPfrGuestAddr, 833 830 natPf.Pfr.u16PfrGuestPort); 834 831 … … 860 857 if (RT_FAILURE(rc)) 861 858 { 862 LogRel(("PF: %s is ignored\n", (*it).Pfr. aszPfrName));859 LogRel(("PF: %s is ignored\n", (*it).Pfr.szPfrName)); 863 860 continue; 864 861 } … … 980 977 for (i = 0; i < count_strs && j < RT_ELEMENTS(m_lo2off); ++i) 981 978 { 982 char aszAddr[17];979 char szAddr[17]; 983 980 RTNETADDRIPV4 ip4addr; 984 981 char *pszTerm; … … 987 984 const char *pszLo2Off = strLo2Off.c_str(); 988 985 989 RT_ZERO( aszAddr);986 RT_ZERO(szAddr); 990 987 991 988 pszTerm = RTStrStr(pszLo2Off, "="); … … 995 992 continue; 996 993 997 memcpy( aszAddr, pszLo2Off, (pszTerm - pszLo2Off));998 rc = RTNetStrToIPv4Addr( aszAddr, &ip4addr);994 memcpy(szAddr, pszLo2Off, (pszTerm - pszLo2Off)); 995 rc = RTNetStrToIPv4Addr(szAddr, &ip4addr); 999 996 if (RT_FAILURE(rc)) 1000 997 continue; -
trunk/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp
r48956 r49113 134 134 Assert(cbRest || pszRaw[idxRaw - 1] == PF_FIELD_SEPARATOR); /* we are 1 char ahead */ 135 135 136 char aszPort[10];137 RT_ZERO( aszPort);136 char szPort[10]; 137 RT_ZERO(szPort); 138 138 139 139 Assert(idxRaw > 0); 140 RTStrCopy( aszPort, RT_MIN(RT_ELEMENTS(aszPort), (size_t)(cbPort) + 1), pszRaw);141 142 if (!(u16Port = RTStrToUInt16( aszPort)))140 RTStrCopy(szPort, RT_MIN(sizeof(szPort), (size_t)(cbPort) + 1), pszRaw); 141 142 if (!(u16Port = RTStrToUInt16(szPort))) 143 143 return -1; 144 144 … … 236 236 memset(pPfr, 0, sizeof(PORTFORWARDRULE)); 237 237 238 pszHostAddr = &pPfr-> aszPfrHostAddr[0];239 pszGuestAddr = &pPfr-> aszPfrGuestAddr[0];240 pszName = &pPfr-> aszPfrName[0];238 pszHostAddr = &pPfr->szPfrHostAddr[0]; 239 pszGuestAddr = &pPfr->szPfrGuestAddr[0]; 240 pszName = &pPfr->szPfrName[0]; 241 241 242 242 cbRaw = strlen(pcszStrPortForward); -
trunk/src/VBox/NetworkServices/NetLib/VBoxPortForwardString.h
r48956 r49113 38 38 typedef struct PORTFORWARDRULE 39 39 { 40 char aszPfrName[PF_NAMELEN];40 char szPfrName[PF_NAMELEN]; 41 41 /* true if ipv6 and false otherwise */ 42 int fPfrIPv6;42 int fPfrIPv6; 43 43 /* IPPROTO_{UDP,TCP} */ 44 int iPfrProto;44 int iPfrProto; 45 45 RTNETADDRU uPfrHostAddr; 46 char aszPfrHostAddr[INET6_ADDRSTRLEN];46 char szPfrHostAddr[INET6_ADDRSTRLEN]; 47 47 uint16_t u16PfrHostPort; 48 48 RTNETADDRU uPfrGuestAddr; 49 char aszPfrGuestAddr[INET6_ADDRSTRLEN];49 char szPfrGuestAddr[INET6_ADDRSTRLEN]; 50 50 uint16_t u16PfrGuestPort; 51 51 } PORTFORWARDRULE, *PPORTFORWARDRULE;
Note:
See TracChangeset
for help on using the changeset viewer.