bug fix in XPS driver, previously this only initialised the memory for string

arguments if this argument existed, causing junk to be sent down to the XPS,
sometimes overflowing its string buffer. This fix moves the memset command up
so this is done even for blank arguments
This commit is contained in:
Peter Denison
2008-05-22 16:49:15 +00:00
parent 8c9053a842
commit 4c2dff5408
+32 -32
View File
@@ -670,66 +670,66 @@ int __stdcall EventExtendedConfigurationTriggerSet (int SocketIndex, int NbEleme
char *list_r;
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
memset(stringArray0,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, ExtendedEventNameList, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
}
char (*stringArray1)[SIZE_NAME];
stringArray1 = new char [NbElements][SIZE_NAME];
stringArray1 = new char [NbElements][SIZE_NAME];
memset(stringArray1,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, EventParameter1List, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray1[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray1[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
}
char (*stringArray2)[SIZE_NAME];
stringArray2 = new char [NbElements][SIZE_NAME];
stringArray2 = new char [NbElements][SIZE_NAME];
memset(stringArray2,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, EventParameter2List, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray2[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray2[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
}
char (*stringArray3)[SIZE_NAME];
stringArray3 = new char [NbElements][SIZE_NAME];
stringArray3 = new char [NbElements][SIZE_NAME];
memset(stringArray3,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, EventParameter3List, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray3[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray3[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
}
char (*stringArray4)[SIZE_NAME];
stringArray4 = new char [NbElements][SIZE_NAME];
stringArray4 = new char [NbElements][SIZE_NAME];
memset(stringArray4,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, EventParameter4List, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray4[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray4[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
@@ -843,66 +843,66 @@ int __stdcall EventExtendedConfigurationActionSet (int SocketIndex, int NbElemen
char *list_r;
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
memset(stringArray0,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, ExtendedActionNameList, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
}
char (*stringArray1)[SIZE_NAME];
stringArray1 = new char [NbElements][SIZE_NAME];
stringArray1 = new char [NbElements][SIZE_NAME];
memset(stringArray1,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, ActionParameter1List, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray1[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray1[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
}
char (*stringArray2)[SIZE_NAME];
stringArray2 = new char [NbElements][SIZE_NAME];
stringArray2 = new char [NbElements][SIZE_NAME];
memset(stringArray2,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, ActionParameter2List, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray2[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray2[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
}
char (*stringArray3)[SIZE_NAME];
stringArray3 = new char [NbElements][SIZE_NAME];
stringArray3 = new char [NbElements][SIZE_NAME];
memset(stringArray3,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, ActionParameter3List, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray3[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray3[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
}
char (*stringArray4)[SIZE_NAME];
stringArray4 = new char [NbElements][SIZE_NAME];
stringArray4 = new char [NbElements][SIZE_NAME];
memset(stringArray4,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, ActionParameter4List, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray4[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray4[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
@@ -1260,14 +1260,14 @@ int __stdcall GatheringConfigurationSet (int SocketIndex, int NbElements, char *
char *list_r;
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
memset(stringArray0,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, TypeList, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
@@ -1514,14 +1514,14 @@ int __stdcall GatheringExternalConfigurationSet (int SocketIndex, int NbElements
char *list_r;
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
memset(stringArray0,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, TypeList, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
@@ -1785,14 +1785,14 @@ int __stdcall GPIOAnalogGet (int SocketIndex, int NbElements, char * GPIONameLis
char *list_r;
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
memset(stringArray0,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, GPIONameList, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
@@ -1869,14 +1869,14 @@ int __stdcall GPIOAnalogSet (int SocketIndex, int NbElements, char * GPIONameLis
char *list_r;
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
memset(stringArray0,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, GPIONameList, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
@@ -1938,14 +1938,14 @@ int __stdcall GPIOAnalogGainGet (int SocketIndex, int NbElements, char * GPIONam
char *list_r;
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
memset(stringArray0,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, GPIONameList, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;
@@ -2022,14 +2022,14 @@ int __stdcall GPIOAnalogGainSet (int SocketIndex, int NbElements, char * GPIONam
char *list_r;
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
memset(stringArray0,'\0', SIZE_NAME*NbElements);
indice = 0;
strncpyWithEOS(list, GPIONameList, SIZE_NOMINAL, SIZE_NOMINAL);
list_r = NULL;
token = strtok_r (list, seps, &list_r);
while ((NULL != token) && (indice < NbElements))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME);
token = strtok_r (NULL, seps, &list_r);
indice++;