VirtualBox

Changeset 85241 in vbox


Ignore:
Timestamp:
Jul 11, 2020 11:03:20 PM (4 years ago)
Author:
vboxsync
Message:

Main/netif.h: Signedness issue in getDefaultIPv4Address(). bugref:9790

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/netif.h

    r82968 r85241  
    115115    Utf8Str strTmp = bstrIfName;
    116116    const char *pcszIfName = strTmp.c_str();
    117     int iInstance = 0;
    118117    size_t iPos = strcspn(pcszIfName, "0123456789");
     118    uint32_t uInstance = 0;
    119119    if (pcszIfName[iPos])
    120         iInstance = RTStrToUInt32(pcszIfName + iPos);
     120        uInstance = RTStrToUInt32(pcszIfName + iPos);
    121121
    122122    in_addr tmp;
    123123#if defined(RT_OS_WINDOWS)
    124     tmp.S_un.S_addr = VBOXNET_IPV4ADDR_DEFAULT + (iInstance << 16);
     124    tmp.S_un.S_addr = VBOXNET_IPV4ADDR_DEFAULT + (uInstance << 16);
    125125#else
    126     tmp.s_addr = VBOXNET_IPV4ADDR_DEFAULT + (iInstance << 16);
     126    tmp.s_addr = VBOXNET_IPV4ADDR_DEFAULT + (uInstance << 16);
    127127#endif
    128128    char *addr = inet_ntoa(tmp);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette