Add parameter checks. Modified: trunk/reactos/lib/setupapi/cfgmgr.c _____
Modified: trunk/reactos/lib/setupapi/cfgmgr.c --- trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-21 18:32:28 UTC (rev 16684) +++ trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-21 20:10:47 UTC (rev 16685) @@ -341,6 +341,15 @@
TRACE("%p %lx %lx %lx\n", pulDepth, dnDevInst, ulFlags, hMachine);
+ if (pulDepth == NULL) + return CR_INVALID_POINTER; + + if (dnDevInst == 0) + return CR_INVALID_DEVINST; + + if (ulFlags != 0) + return CR_INVALID_FLAG; + if (hMachine != NULL) { BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle; @@ -418,6 +427,15 @@ TRACE("%lx %p %ld %ld %lx\n", dnDevInst, Buffer, BufferLen, ulFlags, hMachine);
+ if (dnDevInst == 0) + return CR_INVALID_DEVINST; + + if (Buffer == NULL) + return CR_INVALID_POINTER; + + if (ulFlags != 0) + return CR_INVALID_FLAG; + if (hMachine != NULL) { StringTable = ((PMACHINE_INFO)hMachine)->StringTable; @@ -560,6 +578,15 @@
TRACE("%p %lx %lx %lx\n", pulLen, dnDevInst, ulFlags, hMachine);
+ if (pulLen == NULL) + return CR_INVALID_POINTER; + + if (dnDevInst == 0) + return CR_INVALID_DEVINST; + + if (ulFlags != 0) + return CR_INVALID_FLAG; + if (hMachine != NULL) { StringTable = ((PMACHINE_INFO)hMachine)->StringTable; @@ -614,6 +641,15 @@ TRACE("%p %p %lx %lx %lx\n", pulStatus, pulProblemNumber, dnDevInst, ulFlags, hMachine);
+ if (pulStatus == NULL || pulProblemNumber == NULL) + return CR_INVALID_POINTER; + + if (dnDevInst == 0) + return CR_INVALID_DEVINST; + + if (ulFlags != 0) + return CR_INVALID_FLAG; + if (hMachine != NULL) { BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle; @@ -949,6 +985,12 @@
TRACE("%p %s %lu %lx\n", pdnDevInst, debugstr_w(pDeviceID), ulFlags, hMachine);
+ if (pdnDevInst == NULL) + return CR_INVALID_POINTER; + + if (ulFlags & ~CM_LOCATE_DEVNODE_BITS) + return CR_INVALID_FLAG; + if (hMachine != NULL) { BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;