VirtualBox

Changeset 41891 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 22, 2012 4:56:48 PM (13 years ago)
Author:
vboxsync
Message:

NetShaper: Fixed segmentation fault caused by limits not fitting in 32-bit integer (#5582)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PDMNetShaper.cpp

    r41882 r41891  
    6565    char                                       *pszName;
    6666    /** Maximum number of bytes filters are allowed to transfer. */
    67     volatile uint32_t                           cbTransferPerSecMax;
     67    volatile uint64_t                           cbTransferPerSecMax;
    6868    /** Number of bytes we are allowed to transfer in one burst. */
    6969    volatile uint32_t                           cbBucketSize;
     
    152152#endif
    153153
    154 static void pdmNsBwGroupSetLimit(PPDMNSBWGROUP pBwGroup, uint32_t cbTransferPerSecMax)
     154static void pdmNsBwGroupSetLimit(PPDMNSBWGROUP pBwGroup, uint64_t cbTransferPerSecMax)
    155155{
    156156    pBwGroup->cbTransferPerSecMax = cbTransferPerSecMax;
     
    161161}
    162162
    163 static int pdmNsBwGroupCreate(PPDMNETSHAPER pShaper, const char *pcszBwGroup, uint32_t cbTransferPerSecMax)
     163static int pdmNsBwGroupCreate(PPDMNETSHAPER pShaper, const char *pcszBwGroup, uint64_t cbTransferPerSecMax)
    164164{
    165165    LogFlowFunc(("pShaper=%#p pcszBwGroup=%#p{%s} cbTransferPerSecMax=%u\n",
     
    402402}
    403403
    404 VMMR3DECL(int) PDMR3NsBwGroupSetLimit(PVM pVM, const char *pcszBwGroup, uint32_t cbTransferPerSecMax)
     404VMMR3DECL(int) PDMR3NsBwGroupSetLimit(PVM pVM, const char *pcszBwGroup, uint64_t cbTransferPerSecMax)
    405405{
    406406    PUVM pUVM = pVM->pUVM;
     
    475475{
    476476    PUVM pUVM = pVM->pUVM;
     477    AssertPtrReturn(pUVM, VERR_INVALID_POINTER);
    477478    PPDMNETSHAPER pShaper = pUVM->pdm.s.pNetShaper;
     479    AssertPtrReturn(pShaper, VERR_INVALID_POINTER);
    478480
    479481    /* Destroy the bandwidth managers. */
     
    524526                for (PCFGMNODE pCur = CFGMR3GetFirstChild(pCfgBwGrp); pCur; pCur = CFGMR3GetNextChild(pCur))
    525527                {
    526                     uint32_t cbMax;
     528                    uint64_t cbMax;
    527529                    size_t cchName = CFGMR3GetNameLen(pCur) + 1;
    528530                    char *pszBwGrpId = (char *)RTMemAllocZ(cchName);
     
    538540
    539541                    if (RT_SUCCESS(rc))
    540                         rc = CFGMR3QueryU32(pCur, "Max", &cbMax);
     542                        rc = CFGMR3QueryU64(pCur, "Max", &cbMax);
    541543                    if (RT_SUCCESS(rc))
    542544                        rc = pdmNsBwGroupCreate(pNetShaper, pszBwGrpId, cbMax);
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