|
|
205f9e |
diff -up ./src/configfile.l.coverity ./src/configfile.l
|
|
|
205f9e |
--- ./src/configfile.l.coverity 2018-05-23 16:32:54.524430167 -0700
|
|
|
205f9e |
+++ ./src/configfile.l 2018-05-23 16:37:23.881925045 -0700
|
|
|
205f9e |
@@ -191,9 +191,18 @@ int evaluatetoken(char *pcToken)
|
|
|
205f9e |
}
|
|
|
205f9e |
else
|
|
|
205f9e |
{
|
|
|
205f9e |
+ char *new_reader_list;
|
|
|
205f9e |
reader_list_size++;
|
|
|
205f9e |
- reader_list = realloc(reader_list, reader_list_size *
|
|
|
205f9e |
+ new_reader_list = realloc(reader_list, reader_list_size *
|
|
|
205f9e |
sizeof(SerialReader));
|
|
|
205f9e |
+ if (new_reader_list == NULL) {
|
|
|
205f9e |
+ free(reader_list);
|
|
|
205f9e |
+ }
|
|
|
205f9e |
+ reader_list = new_reader_list;
|
|
|
205f9e |
+ }
|
|
|
205f9e |
+ if (reader_list == NULL) {
|
|
|
205f9e |
+ tok_error("No Memory");
|
|
|
205f9e |
+ return 1;
|
|
|
205f9e |
}
|
|
|
205f9e |
|
|
|
205f9e |
/* end marker */
|
|
|
205f9e |
diff -up ./src/sd-daemon.c.coverity ./src/sd-daemon.c
|
|
|
205f9e |
--- ./src/sd-daemon.c.coverity 2018-05-23 16:28:02.571878672 -0700
|
|
|
205f9e |
+++ ./src/sd-daemon.c 2018-05-23 16:28:05.080883439 -0700
|
|
|
205f9e |
@@ -95,7 +95,7 @@ _sd_export_ int sd_listen_fds(int unset_
|
|
|
205f9e |
goto finish;
|
|
|
205f9e |
}
|
|
|
205f9e |
|
|
|
205f9e |
- if (!(e = getenv("LISTEN_FDS"))) {
|
|
|
205f9e |
+ if (!(e = secure_getenv("LISTEN_FDS"))) {
|
|
|
205f9e |
r = 0;
|
|
|
205f9e |
goto finish;
|
|
|
205f9e |
}
|
|
|
205f9e |
diff -up ./src/winscard_clnt.c.coverity ./src/winscard_clnt.c
|
|
|
205f9e |
--- ./src/winscard_clnt.c.coverity 2018-05-23 16:42:07.437434512 -0700
|
|
|
205f9e |
+++ ./src/winscard_clnt.c 2018-05-23 16:42:10.779440449 -0700
|
|
|
205f9e |
@@ -1541,15 +1541,15 @@ retry:
|
|
|
205f9e |
if (SCARD_AUTOALLOCATE == dwReaderLen)
|
|
|
205f9e |
{
|
|
|
205f9e |
dwReaderLen = *pcchReaderLen;
|
|
|
205f9e |
- bufReader = malloc(dwReaderLen);
|
|
|
205f9e |
- if (NULL == bufReader)
|
|
|
205f9e |
+ if (NULL == mszReaderName)
|
|
|
205f9e |
{
|
|
|
205f9e |
- rv = SCARD_E_NO_MEMORY;
|
|
|
205f9e |
+ rv = SCARD_E_INVALID_PARAMETER;
|
|
|
205f9e |
goto end;
|
|
|
205f9e |
}
|
|
|
205f9e |
- if (NULL == mszReaderName)
|
|
|
205f9e |
+ bufReader = malloc(dwReaderLen);
|
|
|
205f9e |
+ if (NULL == bufReader)
|
|
|
205f9e |
{
|
|
|
205f9e |
- rv = SCARD_E_INVALID_PARAMETER;
|
|
|
205f9e |
+ rv = SCARD_E_NO_MEMORY;
|
|
|
205f9e |
goto end;
|
|
|
205f9e |
}
|
|
|
205f9e |
*(char **)mszReaderName = bufReader;
|
|
|
205f9e |
@@ -1569,15 +1569,15 @@ retry:
|
|
|
205f9e |
if (SCARD_AUTOALLOCATE == dwAtrLen)
|
|
|
205f9e |
{
|
|
|
205f9e |
dwAtrLen = *pcbAtrLen;
|
|
|
205f9e |
- bufAtr = malloc(dwAtrLen);
|
|
|
205f9e |
- if (NULL == bufAtr)
|
|
|
205f9e |
+ if (NULL == pbAtr)
|
|
|
205f9e |
{
|
|
|
205f9e |
- rv = SCARD_E_NO_MEMORY;
|
|
|
205f9e |
+ rv = SCARD_E_INVALID_PARAMETER;
|
|
|
205f9e |
goto end;
|
|
|
205f9e |
}
|
|
|
205f9e |
- if (NULL == pbAtr)
|
|
|
205f9e |
+ bufAtr = malloc(dwAtrLen);
|
|
|
205f9e |
+ if (NULL == bufAtr)
|
|
|
205f9e |
{
|
|
|
205f9e |
- rv = SCARD_E_INVALID_PARAMETER;
|
|
|
205f9e |
+ rv = SCARD_E_NO_MEMORY;
|
|
|
205f9e |
goto end;
|
|
|
205f9e |
}
|
|
|
205f9e |
*(LPBYTE *)pbAtr = bufAtr;
|
|
|
205f9e |
@@ -3098,15 +3098,15 @@ LONG SCardListReaderGroups(SCARDCONTEXT
|
|
|
205f9e |
|
|
|
205f9e |
if (SCARD_AUTOALLOCATE == *pcchGroups)
|
|
|
205f9e |
{
|
|
|
205f9e |
- buf = malloc(dwGroups);
|
|
|
205f9e |
- if (NULL == buf)
|
|
|
205f9e |
+ if (NULL == mszGroups)
|
|
|
205f9e |
{
|
|
|
205f9e |
- rv = SCARD_E_NO_MEMORY;
|
|
|
205f9e |
+ rv = SCARD_E_INVALID_PARAMETER;
|
|
|
205f9e |
goto end;
|
|
|
205f9e |
}
|
|
|
205f9e |
- if (NULL == mszGroups)
|
|
|
205f9e |
+ buf = malloc(dwGroups);
|
|
|
205f9e |
+ if (NULL == buf)
|
|
|
205f9e |
{
|
|
|
205f9e |
- rv = SCARD_E_INVALID_PARAMETER;
|
|
|
205f9e |
+ rv = SCARD_E_NO_MEMORY;
|
|
|
205f9e |
goto end;
|
|
|
205f9e |
}
|
|
|
205f9e |
*(char **)mszGroups = buf;
|
|
|
205f9e |
diff -up ./src/winscard_svc.c.coverity ./src/winscard_svc.c
|
|
|
205f9e |
--- ./src/winscard_svc.c.coverity 2018-05-23 16:30:31.037160692 -0700
|
|
|
205f9e |
+++ ./src/winscard_svc.c 2018-05-23 16:30:35.066168345 -0700
|
|
|
205f9e |
@@ -856,7 +856,8 @@ static LONG MSGAddHandle(SCARDCONTEXT hC
|
|
|
205f9e |
"list_append failed with return value: %d", lrv);
|
|
|
205f9e |
retval = SCARD_E_NO_MEMORY;
|
|
|
205f9e |
}
|
|
|
205f9e |
- retval = SCARD_S_SUCCESS;
|
|
|
205f9e |
+ else
|
|
|
205f9e |
+ retval = SCARD_S_SUCCESS;
|
|
|
205f9e |
}
|
|
|
205f9e |
|
|
|
205f9e |
(void)pthread_mutex_unlock(&threadContext->cardsList_lock);
|