Changeset 43213 in vbox for trunk/src/VBox/ExtPacks/VNC
- Timestamp:
- Sep 6, 2012 8:37:56 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ExtPacks/VNC/VBoxVNC.cpp
r43171 r43213 337 337 uint32_t cbOut = 0; 338 338 size_t resSize = 0; 339 RTNETADDRTYPE iAddrType = RTNETADDRTYPE_INVALID;339 RTNETADDRTYPE enmAddrType; 340 340 char *pszTCPAddress = NULL; 341 341 char *pszTCPPort = NULL; … … 346 346 char *pszServerAddress4 = NULL; 347 347 char *pszServerAddress6 = NULL; 348 char *pszGetAddrInfo4 = NULL; // used to store the result of RTSocket GetAddrInfo()349 char *pszGetAddrInfo6 = NULL; // used to store the result of RTSocket GetAddrInfo()348 char *pszGetAddrInfo4 = NULL; // used to store the result of RTSocketQueryAddressStr() 349 char *pszGetAddrInfo6 = NULL; // used to store the result of RTSocketQueryAddressStr() 350 350 351 351 // get address … … 383 383 pVRDEFeature->u32ClientId = 0; 384 384 385 /** @todo r=bird: I believe this code is more than a little of confused 386 * about how to use RTStrCopy... The 2nd parameter is the size of the 387 * destination buffer, not the size of the source string!! */ 385 388 RTStrCopy(pVRDEFeature->achInfo, 19, "Property/TCP/Ports"); 386 389 … … 404 407 const uint32_t lVNCAddress4FeatureSize = sizeof(VRDEFEATURE) + 24; 405 408 406 pszVNCAddress4 = (char *) RTMemTmpAlloc(24); 407 memset(pszVNCAddress4,'\0',24); 409 pszVNCAddress4 = (char *) RTMemTmpAllocZ(24); 408 410 409 411 pVRDEFeature->u32ClientId = 0; … … 454 456 rc = -1; 455 457 456 pszVNCAddress6 = (char *) RTMemTmpAlloc(VNC_ADDRESS_OPTION_MAX); 457 memset(pszVNCAddress6,'\0',VNC_ADDRESS_OPTION_MAX); 458 pszVNCAddress6 = (char *) RTMemTmpAllocZ(VNC_ADDRESS_OPTION_MAX); 458 459 459 460 pVRDEFeature->u32ClientId = 0; … … 476 477 477 478 // VNCPort6 478 pszVNCPort6 = (char *) RTMemTmpAlloc(6); 479 memset(pszVNCPort6,'\0', 6); 479 pszVNCPort6 = (char *) RTMemTmpAllocZ(6); 480 480 481 481 pVRDEFeature->u32ClientId = 0; … … 573 573 { 574 574 // here we go, we prefer IPv6 over IPv4; 575 pszGetAddrInfo6 = (char *) RTMemTmpAlloc(42);576 memset(pszGetAddrInfo6, '\0', 42);577 575 resSize = 42; 578 iAddrType = RTNETADDRTYPE_IPV6; 579 580 rc = RTSocketGetAddrInfo(pszTCPAddress, pszGetAddrInfo6, &resSize, &iAddrType); 576 pszGetAddrInfo6 = (char *) RTMemTmpAllocZ(resSize); 577 enmAddrType = RTNETADDRTYPE_IPV6; 578 579 rc = RTSocketQueryAddressStr(pszTCPAddress, pszGetAddrInfo6, &resSize, &enmAddrType); 581 580 582 581 if (RT_SUCCESS(rc)) … … 593 592 if (!pszServerAddress6) 594 593 { 595 pszGetAddrInfo4 = (char *) RTMemTmpAlloc(16);596 memset(pszGetAddrInfo4,'\0',16);597 594 resSize = 16; 598 iAddrType = RTNETADDRTYPE_IPV4; 599 600 rc = RTSocketGetAddrInfo(pszTCPAddress, pszGetAddrInfo4, &resSize, &iAddrType); 595 pszGetAddrInfo4 = (char *) RTMemTmpAllocZ(resSize); 596 enmAddrType = RTNETADDRTYPE_IPV4; 597 598 rc = RTSocketQueryAddressStr(pszTCPAddress, pszGetAddrInfo4, &resSize, &enmAddrType); 601 599 602 600 if (RT_SUCCESS(rc)) … … 614 612 if (!pszServerAddress4 && strlen(pszVNCAddress4) > 0) 615 613 { 616 pszGetAddrInfo4 = (char *) RTMemTmpAlloc(16);617 memset(pszGetAddrInfo4,'\0',16);618 614 resSize = 16; 619 iAddrType = RTNETADDRTYPE_IPV4; 620 621 rc = RTSocketGetAddrInfo(pszVNCAddress4, pszGetAddrInfo4, &resSize, &iAddrType); 615 pszGetAddrInfo4 = (char *) RTMemTmpAllocZ(resSize); 616 enmAddrType = RTNETADDRTYPE_IPV4; 617 618 rc = RTSocketQueryAddressStr(pszVNCAddress4, pszGetAddrInfo4, &resSize, &enmAddrType); 622 619 623 620 if (RT_SUCCESS(rc)) … … 628 625 if (!pszServerAddress6 && strlen(pszVNCAddress6) > 0) 629 626 { 630 pszGetAddrInfo6 = (char *) RTMemTmpAlloc(42);631 memset(pszGetAddrInfo6, '\0', 42);632 627 resSize = 42; 633 iAddrType = RTNETADDRTYPE_IPV6; 634 635 rc = RTSocketGetAddrInfo(pszVNCAddress6, pszGetAddrInfo6, &resSize, &iAddrType); 628 pszGetAddrInfo6 = (char *) RTMemTmpAllocZ(resSize); 629 enmAddrType = RTNETADDRTYPE_IPV6; 630 631 rc = RTSocketQueryAddressStr(pszVNCAddress6, pszGetAddrInfo6, &resSize, &enmAddrType); 636 632 637 633 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.