Opened 17 years ago
Closed 17 years ago
#1409 closed defect (fixed)
"pcnetGetMac" error in source code
Reported by: | xasm | Owned by: | |
---|---|---|---|
Component: | other | Version: | VirtualBox 1.5.6 |
Keywords: | pcnetGetMac | Cc: | |
Guest type: | other | Host type: | other |
Description
Hi,
I found a bug on the input parameter for a function in source code(maybe a "clerical error"),Although the function hasn't been used as yet , I think it will cause the problem if it is used. here are the information for the bug:
function name:pcnetGetMac,
file:/src/vbox/devices/network/devpcnet.cpp static DECLCALLBACK(int) pcnetGetMac(PPDMINETWORKCONFIG pInterface, PPDMMAC *pMac) {
PCNetState *pData = INETWORKCONFIG_2_DATA(pInterface); memcpy(pMac, pData->aPROM, sizeof(*pMac)); return VINF_SUCCESS;
}
file:/include/vbox/pdmifs.h typedef PDMMAC *PPDMMAC; DECLR3CALLBACKMEMBER(int, pfnGetMac,(PPDMINETWORKCONFIG pInterface, PPDMMAC *pMac));
the purpose on function is to output MAC address(6 Bytes), but pay attention to the second input parameter, the type is "PPDMMAC *" (double pointer), after execute "memcpy(pMac, pData->aPROM, sizeof(*pMac))", obviously it can't get result that we want.
so,it should change the type for input parameter from "PPDMMAC *" to "PPDMMAC".
Thank you for this report. I've fixed that in SVN. The changes are visible in the public SVN after the next sync.