Fixed defects

List of Defects

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c: scope_hint: In function 'get_ccid_device_descriptor'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c:1238:31: warning[-Wanalyzer-null-dereference]: dereference of NULL 'usb_interface'
# 1236|   #endif
# 1237|   
# 1238|-> 	if (0 == usb_interface->num_altsetting) {
# 1239|   		/* No interface descriptor available. */
# 1240|   		return NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def2]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c: scope_hint: In function ‘get_ccid_device_descriptor’
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c:1238:31: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘usb_interface’
# 1236|   #endif
# 1237|   
# 1238|-> 	if (0 == usb_interface->num_altsetting) {
# 1239|   		/* No interface descriptor available. */
# 1240|   		return NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c: scope_hint: In function 'get_end_points'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c:1291:34: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
# 1289|   	 * 3 Endpoints maximum: Interrupt In, Bulk In, Bulk Out
# 1290|   	 */
# 1291|-> 	for (i=0; i<usb_interface->altsetting->bNumEndpoints; i++)
# 1292|   	{
# 1293|   		/* interrupt end point (if available) */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c: scope_hint: In function ‘get_end_points’
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c:1291:34: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
# 1289|   	 * 3 Endpoints maximum: Interrupt In, Bulk In, Bulk Out
# 1290|   	 */
# 1291|-> 	for (i=0; i<usb_interface->altsetting->bNumEndpoints; i++)
# 1292|   	{
# 1293|   		/* interrupt end point (if available) */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c: scope_hint: In function 'get_data_rates'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c:1433:96: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
# 1431|   	int bNumDataRatesSupported;
# 1432|   
# 1433|-> 	bNumDataRatesSupported = get_ccid_device_descriptor(get_ccid_usb_interface(desc, &num))[27];
# 1434|   	if (0 == bNumDataRatesSupported)
# 1435|   		/* read up to the buffer size */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c: scope_hint: In function ‘get_data_rates’
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/ccid_usb.c:1433:96: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
# 1431|   	int bNumDataRatesSupported;
# 1432|   
# 1433|-> 	bNumDataRatesSupported = get_ccid_device_descriptor(get_ccid_usb_interface(desc, &num))[27];
# 1434|   	if (0 == bNumDataRatesSupported)
# 1435|   		/* read up to the buffer size */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/simclist.c: scope_hint: In function 'list_delete_range'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/simclist.c:601:15: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
#  599|   
#  600|       tmp = list_findpos(l, posstart);    /* first el to be deleted */
#  601|->     lastvalid = tmp->prev;              /* last valid element */
#  602|   
#  603|       midposafter = (l->numels-1-numdel)/2;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.c: scope_hint: In function 'yy_create_buffer'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.c:1335:12: warning[-Wanalyzer-malloc-leak]: leak of 'malloc(64)'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.c:713:1: note: in expansion of macro 'YY_DECL'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.c: scope_hint: In function 'yy_create_buffer'
# 1333|   	 */
# 1334|   	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
# 1335|-> 	if ( ! b->yy_ch_buf )
# 1336|   		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
# 1337|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def9]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.l: scope_hint: In function 'eval_key'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.l:98:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'elt'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.c:713: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): [#def10]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.l:99:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'malloc(len)' where non-null expected
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.c:713: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): [#def11]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.l: scope_hint: In function 'eval_value'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.l:131:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'value' where non-null expected
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.c:713: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): [#def12]
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.l:155:1: warning[-Wanalyzer-malloc-leak]: leak of 'amp'
pcsc-lite-ccid-1.5.5-build/ccid-1.5.5/src/tokenparser.c:713:1: note: in expansion of macro 'YY_DECL'
#  153|   	assert(r >= 0);
#  154|   	(void)r;
#  155|-> }
#  156|   
#  157|   void tperrorCheck (char *token_error)

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
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-102.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namepcsc-lite-ccid-1.6.0-1.fc41
diffbase-store-results-to/tmp/tmpcatxjhgu/pcsc-lite-ccid-1.6.0-1.fc41.tar.xz
diffbase-time-created2024-07-03 16:33:44
diffbase-time-finished2024-07-03 16:34:49
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpcatxjhgu/pcsc-lite-ccid-1.6.0-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpcatxjhgu/pcsc-lite-ccid-1.6.0-1.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-102.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namepcsc-lite-ccid-1.5.5-3.fc40
store-results-to/tmp/tmpbure_tuf/pcsc-lite-ccid-1.5.5-3.fc40.tar.xz
time-created2024-07-03 16:32:02
time-finished2024-07-03 16:33:34
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpbure_tuf/pcsc-lite-ccid-1.5.5-3.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpbure_tuf/pcsc-lite-ccid-1.5.5-3.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9