pcsc-lite-2.2.3-1.fc41

List of Defects

Error: CPPCHECK_WARNING: [#def1]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c: scope_hint: In function ‘configfile_create_buffer’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:1581:12: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(64)’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/configfile.l:387:23: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:938:21: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:958:1: note: in expansion of macro ‘YY_DECL’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:982:18: note: in expansion of macro ‘yyensure_buffer_stack’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:982:18: note: in expansion of macro ‘yyensure_buffer_stack’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:1720:13: note: in expansion of macro ‘yyensure_buffer_stack’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:982:18: note: in expansion of macro ‘yyensure_buffer_stack’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:984:26: note: in expansion of macro ‘yy_create_buffer’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:1567:21: note: in expansion of macro ‘yy_create_buffer’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:1571:24: note: in expansion of macro ‘yyalloc’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c: scope_hint: In function ‘configfile_create_buffer’
# 1579|   	 * we need to put in 2 end-of-buffer characters.
# 1580|   	 */
# 1581|-> 	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
# 1582|   	if ( ! b->yy_ch_buf )
# 1583|   		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

Error: CPPCHECK_WARNING (CWE-476): [#def3]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:1621: warning[nullPointer]: Possible null pointer dereference: b
# 1619|       
# 1620|   	yy_flush_buffer( b );
# 1621|-> 
# 1622|   	b->yy_input_file = file;
# 1623|   	b->yy_fill_buffer = 1;

Error: CPPCHECK_WARNING (CWE-476): [#def4]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/configfile.c:1622: warning[nullPointer]: Possible null pointer dereference: b
# 1620|   	yy_flush_buffer( b );
# 1621|   
# 1622|-> 	b->yy_input_file = file;
# 1623|   	b->yy_fill_buffer = 1;
# 1624|   

Error: CPPCHECK_WARNING: [#def5]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c: scope_hint: In function ‘tokenparser_create_buffer’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:1594:12: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(64)’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l:228:23: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:952:21: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:972:1: note: in expansion of macro ‘YY_DECL’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:996:18: note: in expansion of macro ‘yyensure_buffer_stack’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:996:18: note: in expansion of macro ‘yyensure_buffer_stack’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:1733:13: note: in expansion of macro ‘yyensure_buffer_stack’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:996:18: note: in expansion of macro ‘yyensure_buffer_stack’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:998:26: note: in expansion of macro ‘yy_create_buffer’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:1580:21: note: in expansion of macro ‘yy_create_buffer’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:1584:24: note: in expansion of macro ‘yyalloc’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c: scope_hint: In function ‘tokenparser_create_buffer’
# 1592|   	 * we need to put in 2 end-of-buffer characters.
# 1593|   	 */
# 1594|-> 	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
# 1595|   	if ( ! b->yy_ch_buf )
# 1596|   		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

Error: CPPCHECK_WARNING (CWE-476): [#def7]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:1634: warning[nullPointer]: Possible null pointer dereference: b
# 1632|       
# 1633|   	yy_flush_buffer( b );
# 1634|-> 
# 1635|   	b->yy_input_file = file;
# 1636|   	b->yy_fill_buffer = 1;

Error: CPPCHECK_WARNING (CWE-476): [#def8]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:1635: warning[nullPointer]: Possible null pointer dereference: b
# 1633|   	yy_flush_buffer( b );
# 1634|   
# 1635|-> 	b->yy_input_file = file;
# 1636|   	b->yy_fill_buffer = 1;
# 1637|   

Error: CPPCHECK_WARNING: [#def9]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/atrhandler.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def10]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/debuglog.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def11]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/eventhandler.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def12]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c: scope_hint: In function ‘HPReadBundleValues’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:235:44: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:169:25: note: in expansion of macro ‘GET_KEY’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:169:25: note: in expansion of macro ‘GET_KEY’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:177:25: note: in expansion of macro ‘GET_KEY’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:178:25: note: in expansion of macro ‘GET_KEY’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:178:25: note: in expansion of macro ‘GET_KEY’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:179:25: note: in expansion of macro ‘GET_KEY’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:179:25: note: in expansion of macro ‘GET_KEY’
#  233|   						driverSize * sizeof(*driverTracker));
#  234|   
#  235|-> 					if (NULL == tmp)
#  236|   					{
#  237|   						free(driverTracker);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def14]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c: scope_hint: In function ‘HPAddDevice’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:467:36: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘tmpInterfaceName’ where non-null expected
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/hotplug_libudev.c:47: included_from: Included from here.
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
#  465|   
#  466|   		/* check the interface name contains only valid ASCII codes */
#  467|-> 		for (size_t i=0; i<strlen(tmpInterfaceName); i++)
#  468|   		{
#  469|   			if (! isascii(tmpInterfaceName[i]))

Error: CPPCHECK_WARNING: [#def15]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/ifdwrapper.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-476): [#def16]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/ifdwrapper.c: scope_hint: In function ‘IFDOpenIFD’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/ifdwrapper.c:136:31: warning[-Wanalyzer-jump-through-null]: jump through null pointer
#  134|   		/* use device name only if defined */
#  135|   		if (rContext->device[0] != '\0')
#  136|-> 			rv = (*IFDH_create_channel_by_name) (rContext->slot, rContext->device);
#  137|   		else
#  138|   			rv = (*IFDH_create_channel) (rContext->slot, rContext->port);

Error: CPPCHECK_WARNING: [#def17]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/libredirect.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def18]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/pcscdaemon.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-775): [#def19]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/pcscdaemon.c: scope_hint: In function ‘main’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/pcscdaemon.c:564:28: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
#  562|   
#  563|   			/* do not close stdin, stdout or stderr */
#  564|-> 			if (fd > 2)
#  565|   				close(fd);
#  566|   		}

Error: CPPCHECK_WARNING: [#def20]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-476): [#def21]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c: scope_hint: In function ‘RFAddReader’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:345:56: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(4)’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:57: included_from: Included from here.
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:1527:17: note: in expansion of macro ‘Log2’
#  343|   		   RFUnloadReader unloads the driver library
#  344|   		   and there are still devices attached using it --mikeg*/
#  345|-> 		*(sReadersContexts[dwContext])->pFeeds = 1;
#  346|   	}
#  347|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def22]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:352:23: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(40)’ where non-null expected
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:1527:17: note: in expansion of macro ‘Log2’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:51: included_from: Included from here.
/usr/include/pthread.h:781:12: note: argument 1 of ‘pthread_mutex_init’ must be non-null
#  350|   		sReadersContexts[dwContext]->mMutex =
#  351|   			malloc(sizeof(pthread_mutex_t));
#  352|-> 		(void)pthread_mutex_init(sReadersContexts[dwContext]->mMutex, NULL);
#  353|   	}
#  354|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def23]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:358:56: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(4)’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:1527:17: note: in expansion of macro ‘Log2’
#  356|   	{
#  357|   		sReadersContexts[dwContext]->pMutex = malloc(sizeof(int));
#  358|-> 		*(sReadersContexts[dwContext])->pMutex = 1;
#  359|   	}
#  360|   

Error: GCC_ANALYZER_WARNING: [#def24]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:449:17: warning[-Wanalyzer-overlapping-buffers]: overlapping buffers passed as arguments to ‘memcpy’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:1527:17: note: in expansion of macro ‘Log2’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:933:17: note: in expansion of macro ‘Log1’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:45: included_from: Included from here.
/usr/include/string.h:43:14: note: the behavior of ‘memcpy’ is undefined for overlapping buffers
#  447|   		/* Copy the previous reader name and increment the slot number */
#  448|   		tmpReader = sReadersContexts[dwContextB]->readerState->readerName;
#  449|-> 		memcpy(tmpReader,
#  450|   			sReadersContexts[dwContext]->readerState->readerName,
#  451|   			sizeof(sReadersContexts[dwContextB]->readerState->readerName));

Error: GCC_ANALYZER_WARNING (CWE-688): [#def25]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:525:31: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(40)’ where non-null expected
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:1527:17: note: in expansion of macro ‘Log2’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:933:17: note: in expansion of macro ‘Log1’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:517:25: note: in expansion of macro ‘Log1’
/usr/include/pthread.h:781:12: note: argument 1 of ‘pthread_mutex_init’ must be non-null
#  523|   			sReadersContexts[dwContextB]->mMutex =
#  524|   				malloc(sizeof(pthread_mutex_t));
#  525|-> 			(void)pthread_mutex_init(sReadersContexts[dwContextB]->mMutex,
#  526|   				NULL);
#  527|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def26]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:529:65: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(4)’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:1527:17: note: in expansion of macro ‘Log2’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:933:17: note: in expansion of macro ‘Log1’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:517:25: note: in expansion of macro ‘Log1’
#  527|   
#  528|   			sReadersContexts[dwContextB]->pMutex = malloc(sizeof(int));
#  529|-> 			*(sReadersContexts[dwContextB])->pMutex = 1;
#  530|   		}
#  531|   		else

Error: CLANG_WARNING: [#def27]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/readerfactory.c:710:14: warning[deadcode.DeadStores]: Value stored to 'extend' during its initialization is never read
#  708|   	bool usedDigits[PCSCLITE_MAX_READERS_CONTEXTS];
#  709|   	int i;
#  710|-> 	const char *extend = "";
#  711|   
#  712|   	/* Clear the list */

Error: CPPCHECK_WARNING: [#def28]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def29]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c: scope_hint: In function ‘list_restore_filedescriptor’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:100:64: warning[-Wanalyzer-malloc-leak]: leak of ‘buf’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1297:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1297:5: note: in expansion of macro ‘READ_ERRCHECK’
/usr/include/arpa/inet.h:22: included_from: Included from here.
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:39: included_from: Included from here.
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1305:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1305:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1307:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1311:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1316:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1320:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1324:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1328:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:98:74: note: in definition of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1342:17: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1297:5: note: in expansion of macro ‘READ_ERRCHECK’
#   98|                                                       if (read(fd, msgbuf, msglen) != msglen) {           \
#   99|                                                           /*errno = EPROTO;*/                             \
#  100|->                                                         return -1;                                      \
#  101|                                                       }                                                   \
#  102|                                                   } while (0);

Error: CLANG_WARNING: [#def30]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:802:67: warning[core.NullDereference]: Access to field 'next' results in a dereference of a null pointer (loaded from field 'mid')
#  800|       if ((err+1)/2 > 0) {        /* correct pos RIGHT (err-1)/2 moves */
#  801|           err = (err+1)/2;
#  802|->         for (cnt = 0; cnt < (unsigned int)err; cnt++) dest->mid = dest->mid->next;
#  803|       } else if (err/2 < 0) { /* correct pos LEFT (err/2)-1 moves */
#  804|           err = -err/2;

Error: CLANG_WARNING: [#def31]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:805:67: warning[core.NullDereference]: Access to field 'prev' results in a dereference of a null pointer (loaded from field 'mid')
#  803|       } else if (err/2 < 0) { /* correct pos LEFT (err/2)-1 moves */
#  804|           err = -err/2;
#  805|->         for (cnt = 0; cnt < (unsigned int)err; cnt++) dest->mid = dest->mid->prev;
#  806|       }
#  807|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def32]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1349:23: warning[-Wanalyzer-malloc-leak]: leak of ‘buf’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1297:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1305:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1305:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1307:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1311:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1316:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1320:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1324:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1328:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1352:17: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1352:17: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c: scope_hint: In function ‘list_restore_filedescriptor’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c: scope_hint: In function ‘list_restore_filedescriptor’
# 1347|               /* copy verbatim into memory */
# 1348|               for (cnt = 0; cnt < header.numels; cnt++) {
# 1349|->                 buf = malloc(header.elemlen);
# 1350|                   if (NULL == buf)
# 1351|                       return -1;

Error: CLANG_WARNING: [#def33]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1357:22: warning[unix.Malloc]: Potential leak of memory pointed to by 'buf'
# 1355|               totmemorylen = header.numels * header.elemlen;
# 1356|           }
# 1357|->         totreadlen = header.numels * header.elemlen;
# 1358|       } else {
# 1359|           /* elements have variable size. Each element is preceded by its size */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def34]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1376:23: warning[-Wanalyzer-malloc-leak]: leak of ‘buf’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1297:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1305:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1305:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1307:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1311:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1316:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1320:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1324:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1328:5: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1375:17: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1375:17: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1379:17: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1379:17: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c: scope_hint: In function ‘list_restore_filedescriptor’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c: scope_hint: In function ‘list_restore_filedescriptor’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1375:17: note: in expansion of macro ‘READ_ERRCHECK’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/simclist.c:1375:17: note: in expansion of macro ‘READ_ERRCHECK’
# 1374|               for (cnt = 0; cnt < header.numels; cnt++) {
# 1375|                   READ_ERRCHECK(fd, & elsize, sizeof(elsize));
# 1376|->                 buf = malloc(elsize);
# 1377|                   if (NULL == buf)
# 1378|                       return -1;

Error: CPPCHECK_WARNING: [#def35]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/spy/libpcscspy.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def36]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/spy/libpcscspy.c:126:2: warning[deadcode.DeadStores]: Value stored to 'r' is never read
#  124|   	snprintf(threadid, sizeof threadid, "%lX@", pthread_self());
#  125|   	pthread_mutex_lock(&Log_fd_mutex);
#  126|-> 	r = write(Log_fd, threadid, strlen(threadid));
#  127|   	r = write(Log_fd, line, strlen(line));
#  128|   	r = write(Log_fd, "\n", 1);

Error: CLANG_WARNING: [#def37]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/spy/libpcscspy.c:127:2: warning[deadcode.DeadStores]: Value stored to 'r' is never read
#  125|   	pthread_mutex_lock(&Log_fd_mutex);
#  126|   	r = write(Log_fd, threadid, strlen(threadid));
#  127|-> 	r = write(Log_fd, line, strlen(line));
#  128|   	r = write(Log_fd, "\n", 1);
#  129|   	(void)r;

Error: CLANG_WARNING: [#def38]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/spy/libpcscspy.c:155:2: warning[deadcode.DeadStores]: Value stored to 'r' is never read
#  153|   	snprintf(threadid, sizeof threadid, "%lX@", pthread_self());
#  154|   	pthread_mutex_lock(&Log_fd_mutex);
#  155|-> 	r = write(Log_fd, threadid, strlen(threadid));
#  156|   	r = write(Log_fd, line, size);
#  157|   	r = write(Log_fd, "\n", 1);

Error: CLANG_WARNING: [#def39]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/spy/libpcscspy.c:156:2: warning[deadcode.DeadStores]: Value stored to 'r' is never read
#  154|   	pthread_mutex_lock(&Log_fd_mutex);
#  155|   	r = write(Log_fd, threadid, strlen(threadid));
#  156|-> 	r = write(Log_fd, line, size);
#  157|   	r = write(Log_fd, "\n", 1);
#  158|   	(void)r;

Error: CPPCHECK_WARNING: [#def40]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/testpcsc.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-786): [#def41]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/testpcsc.c:232: error[negativeIndex]: Array 'iList[16]' accessed at index -1, which is out of bounds.
#  230|   		iReader = 1;
#  231|   
#  232|-> 	rgReaderStates[0].szReader = &mszReaders[iList[iReader]];
#  233|   	rgReaderStates[0].dwCurrentState = SCARD_STATE_EMPTY;
#  234|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def42]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l: scope_hint: In function ‘eval_key’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l:98:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘elt’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l:228:23: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:952:21: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:972:1: note: in expansion of macro ‘YY_DECL’
#   96|   	len++;	/* final NULL byte */
#   97|   
#   98|-> 	elt->key = malloc(len);
#   99|   	memcpy(elt->key, &pcToken[5], len-1);
#  100|   	elt->key[len-1] = '\0';

Error: GCC_ANALYZER_WARNING (CWE-688): [#def43]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l:99:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(len)’ where non-null expected
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l:228:23: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:952:21: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:972:1: note: in expansion of macro ‘YY_DECL’
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#   97|   
#   98|   	elt->key = malloc(len);
#   99|-> 	memcpy(elt->key, &pcToken[5], len-1);
#  100|   	elt->key[len-1] = '\0';
#  101|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def44]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l: scope_hint: In function ‘eval_value’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l:131:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘value’ where non-null expected
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l:228:23: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:952:21: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:972:1: note: in expansion of macro ‘YY_DECL’
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#  129|   	assert(value);
#  130|   
#  131|-> 	memcpy(value, &pcToken[8], len-1);
#  132|   	value[len-1] = '\0';
#  133|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def45]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l:155:1: warning[-Wanalyzer-malloc-leak]: leak of ‘amp’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/tokenparser.l:228:23: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:952:21: note: in expansion of macro ‘yylex’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/redhat-linux-build/pcscd.p/tokenparser.c:972:1: note: in expansion of macro ‘YY_DECL’
#  153|   	assert(r >= 0);
#  154|   	(void)r;
#  155|-> }
#  156|   
#  157|   void tperrorCheck (char *token_error)

Error: CPPCHECK_WARNING: [#def46]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/winscard.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def47]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/winscard_clnt.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def48]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/winscard_clnt.c: scope_hint: In function ‘SCardAddHandle’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/winscard_clnt.c:3445:12: warning[-Wanalyzer-malloc-leak]: leak of ‘newChannelMap’
# 3443|   
# 3444|   	lrv = list_append(&currentContextMap->channelMapList, newChannelMap);
# 3445|-> 	if (lrv < 0)
# 3446|   	{
# 3447|   		free(newChannelMap->readerName);

Error: CLANG_WARNING: [#def49]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/winscard_clnt.c:3454:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'newChannelMap'
# 3452|   	}
# 3453|   
# 3454|-> 	return SCARD_S_SUCCESS;
# 3455|   }
# 3456|   

Error: CPPCHECK_WARNING: [#def50]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/winscard_msg.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-775): [#def51]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/winscard_msg.c: scope_hint: In function ‘ClientSetupSession’
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/winscard_msg.c:138:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor
#  136|   	strncpy(svc_addr.sun_path, socketName, sizeof(svc_addr.sun_path));
#  137|   
#  138|-> 	if (connect(*pdwClientID, (struct sockaddr *) &svc_addr,
#  139|   			sizeof(svc_addr.sun_family) + strlen(svc_addr.sun_path) + 1) < 0)
#  140|   	{

Error: CPPCHECK_WARNING: [#def52]
pcsc-lite-2.2.3-build/pcsc-lite-2.2.3/src/winscard_svc.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-142.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namepcsc-lite-2.2.3-1.fc41
store-results-to/tmp/tmpb4pvefem/pcsc-lite-2.2.3-1.fc41.tar.xz
time-created2024-07-03 16:34:33
time-finished2024-07-03 16:35:43
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpb4pvefem/pcsc-lite-2.2.3-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpb4pvefem/pcsc-lite-2.2.3-1.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9