VirtualBox

Ignore:
Timestamp:
Jan 8, 2020 9:14:38 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135563
Message:

VBoxUSB: Use USBFilterIsMethodUsingStringValue() because USBFILTERMATCH_NUM_EXPRESSION uses a string value while not being a string field, some additional checks, @bugref{9622}

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/USBFilter.cpp

    r76553 r82662  
    327327    }
    328328
     329    /* Validate that string value offsets are inside the string table. */
     330    for (uint32_t i = 0; i < RT_ELEMENTS(pFilter->aFields); i++)
     331    {
     332        if (    USBFilterIsMethodUsingStringValue((USBFILTERMATCH)pFilter->aFields[i].enmMatch)
     333            &&  pFilter->aFields[i].u16Value > pFilter->offCurEnd)
     334        {
     335            Log(("USBFilter: %p - bad offset=%#x\n", pFilter->aFields[i].u16Value));
     336            return VERR_INVALID_PARAMETER;
     337        }
     338    }
     339
    329340    /*
    330341     * Validate the string table.
     
    350361        unsigned i;
    351362        for (i = 0; i < RT_ELEMENTS(pFilter->aFields); i++)
    352             if (    USBFilterIsMethodString((USBFILTERMATCH)pFilter->aFields[i].enmMatch)
     363            if (    USBFilterIsMethodUsingStringValue((USBFILTERMATCH)pFilter->aFields[i].enmMatch)
    353364                &&  pFilter->aFields[i].u16Value == off)
    354365                break;
     
    17911802
    17921803/**
    1793  * Checks if a matching method is for string fields or not.
     1804 * Checks if a matching method is for numeric fields or not.
    17941805 *
    17951806 * @returns true / false.
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