Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/pcsc-lite-1.9.0/doc/example/pcsc_demo.c Examining data/pcsc-lite-1.9.0/src/winscard_msg_srv.c Examining data/pcsc-lite-1.9.0/src/atrhandler.c Examining data/pcsc-lite-1.9.0/src/winscard_msg.c Examining data/pcsc-lite-1.9.0/src/hotplug_linux.c Examining data/pcsc-lite-1.9.0/src/readerfactory.h Examining data/pcsc-lite-1.9.0/src/dyn_generic.h Examining data/pcsc-lite-1.9.0/src/PCSC/wintypes.h Examining data/pcsc-lite-1.9.0/src/PCSC/debuglog.h Examining data/pcsc-lite-1.9.0/src/PCSC/winscard.h Examining data/pcsc-lite-1.9.0/src/PCSC/pcsclite.h Examining data/pcsc-lite-1.9.0/src/PCSC/reader.h Examining data/pcsc-lite-1.9.0/src/PCSC/ifdhandler.h Examining data/pcsc-lite-1.9.0/src/utils.h Examining data/pcsc-lite-1.9.0/src/debug.c Examining data/pcsc-lite-1.9.0/src/winscard_msg.h Examining data/pcsc-lite-1.9.0/src/simclist.h Examining data/pcsc-lite-1.9.0/src/dyn_unix.c Examining data/pcsc-lite-1.9.0/src/error.c Examining data/pcsc-lite-1.9.0/src/dyn_macosx.c Examining data/pcsc-lite-1.9.0/src/winscard_clnt.c Examining data/pcsc-lite-1.9.0/src/debuglog.c Examining data/pcsc-lite-1.9.0/src/pcsc-wirecheck-gen.c Examining data/pcsc-lite-1.9.0/src/hotplug_macosx.c Examining data/pcsc-lite-1.9.0/src/utils.c Examining data/pcsc-lite-1.9.0/src/sys_unix.c Examining data/pcsc-lite-1.9.0/src/tokenparser.c Examining data/pcsc-lite-1.9.0/src/pcsc-wirecheck-main.c Examining data/pcsc-lite-1.9.0/src/eventhandler.h Examining data/pcsc-lite-1.9.0/src/hotplug_generic.c Examining data/pcsc-lite-1.9.0/src/sys_generic.h Examining data/pcsc-lite-1.9.0/src/misc.h Examining data/pcsc-lite-1.9.0/src/hotplug_libusb.c Examining data/pcsc-lite-1.9.0/src/readerfactory.c Examining data/pcsc-lite-1.9.0/src/testpcsc.c Examining data/pcsc-lite-1.9.0/src/pcscd.h Examining data/pcsc-lite-1.9.0/src/pcscdaemon.c Examining data/pcsc-lite-1.9.0/src/winscard_svc.h Examining data/pcsc-lite-1.9.0/src/ifdwrapper.c Examining data/pcsc-lite-1.9.0/src/parser.h Examining data/pcsc-lite-1.9.0/src/atrhandler.h Examining data/pcsc-lite-1.9.0/src/prothandler.c Examining data/pcsc-lite-1.9.0/src/pcsc-wirecheck-dist.c Examining data/pcsc-lite-1.9.0/src/simclist.c Examining data/pcsc-lite-1.9.0/src/dyn_hpux.c Examining data/pcsc-lite-1.9.0/src/hotplug_libudev.c Examining data/pcsc-lite-1.9.0/src/eventhandler.c Examining data/pcsc-lite-1.9.0/src/hotplug.h Examining data/pcsc-lite-1.9.0/src/prothandler.h Examining data/pcsc-lite-1.9.0/src/configfile.c Examining data/pcsc-lite-1.9.0/src/lassert.h Examining data/pcsc-lite-1.9.0/src/configfile.h Examining data/pcsc-lite-1.9.0/src/spy/libpcscspy.c Examining data/pcsc-lite-1.9.0/src/winscard_svc.c Examining data/pcsc-lite-1.9.0/src/auth.h Examining data/pcsc-lite-1.9.0/src/auth.c Examining data/pcsc-lite-1.9.0/src/winscard.c Examining data/pcsc-lite-1.9.0/src/ifdwrapper.h FINAL RESULTS: data/pcsc-lite-1.9.0/src/pcscdaemon.c:631:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. (void)chmod(PCSCLITE_IPC_DIR, mode); data/pcsc-lite-1.9.0/src/winscard_msg_srv.c:163:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. (void)chmod(PCSCLITE_CSOCK_NAME, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); data/pcsc-lite-1.9.0/doc/example/pcsc_demo.c:41:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(text ": %s (0x%lX)\n", pcsc_stringify_error(rv), rv); \ data/pcsc-lite-1.9.0/doc/example/pcsc_demo.c:46:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(text ": OK\n\n"); \ data/pcsc-lite-1.9.0/src/PCSC/debuglog.h:121:24: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((format(printf, 2, 3))); data/pcsc-lite-1.9.0/src/debug.c:120:8: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. (void)vsnprintf(DebugBuffer, DEBUG_BUF_SIZE, fmt, argptr); data/pcsc-lite-1.9.0/src/debuglog.c:127:2: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(DebugBuffer, sizeof DebugBuffer, fmt, argptr); data/pcsc-lite-1.9.0/src/debuglog.c:215:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(DebugBuffer, msg); data/pcsc-lite-1.9.0/src/debuglog.c:350:2: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(DebugBuffer, sizeof DebugBuffer, fmt, argptr); data/pcsc-lite-1.9.0/src/lassert.h:58:13: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, "%s:%d: assertion FAILED: " #cond ": " fmt, \ data/pcsc-lite-1.9.0/src/readerfactory.c:182:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(filter, ro_filter); data/pcsc-lite-1.9.0/src/readerfactory.c:215:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(readerName, readerNameLong); data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:151:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args); data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:192:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. size = vsnprintf(line, sizeof line, fmt, args); data/pcsc-lite-1.9.0/src/testpcsc.c:64:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(BLUE "%s (don't panic)\n" NORMAL, pcsc_stringify_error(rv)); data/pcsc-lite-1.9.0/src/testpcsc.c:67:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(RED "%s\n" NORMAL, pcsc_stringify_error(rv)); data/pcsc-lite-1.9.0/src/testpcsc.c:114:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MAGENTA "THIS PROGRAM IS NOT DESIGNED AS A TESTING TOOL FOR END USERS!\n"); data/pcsc-lite-1.9.0/src/testpcsc.c:115:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("Do NOT use it unless you really know what you do.\n\n" NORMAL); data/pcsc-lite-1.9.0/src/testpcsc.c:150:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(GREEN "Group %02d: %s\n" NORMAL, p, &mszGroups[i]); data/pcsc-lite-1.9.0/src/testpcsc.c:200:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(GREEN "Reader %02d: %s\n" NORMAL, p, &mszReaders[i]); data/pcsc-lite-1.9.0/src/testpcsc.c:273:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(" card response:" GREEN); data/pcsc-lite-1.9.0/src/testpcsc.c:276:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("\n" NORMAL); data/pcsc-lite-1.9.0/src/testpcsc.c:313:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("SCARD_ATTR_DEVICE_FRIENDLY_NAME length: " GREEN "%ld\n" NORMAL, pcbAttrLen); data/pcsc-lite-1.9.0/src/testpcsc.c:322:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("SCARD_ATTR_DEVICE_FRIENDLY_NAME: " GREEN "%s\n" NORMAL, pbAttr); data/pcsc-lite-1.9.0/src/testpcsc.c:343:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("SCARD_ATTR_ATR_STRING length: " GREEN "%ld\n" NORMAL, pcbAttrLen); data/pcsc-lite-1.9.0/src/testpcsc.c:353:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("SCARD_ATTR_ATR_STRING length: " GREEN "%ld\n" NORMAL, pcbAttrLen); data/pcsc-lite-1.9.0/src/testpcsc.c:354:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("SCARD_ATTR_ATR_STRING: " GREEN); data/pcsc-lite-1.9.0/src/testpcsc.c:357:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("\n" NORMAL); data/pcsc-lite-1.9.0/src/testpcsc.c:386:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(RED "Unsupported size\n" NORMAL); data/pcsc-lite-1.9.0/src/testpcsc.c:396:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(GREEN "%d.%d.%d\n" NORMAL, M, m, b); data/pcsc-lite-1.9.0/src/testpcsc.c:407:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("Max message length\t\t: " GREEN "%d\n" NORMAL, data/pcsc-lite-1.9.0/src/testpcsc.c:410:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(RED "Wrong size" NORMAL); data/pcsc-lite-1.9.0/src/testpcsc.c:418:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("Vendor name\t\t\t: " GREEN "%s\n" NORMAL, buf.as_char); data/pcsc-lite-1.9.0/src/testpcsc.c:441:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("Current Reader Name\t\t: " GREEN "%s\n" NORMAL, pcReader); data/pcsc-lite-1.9.0/src/testpcsc.c:442:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("Current Reader State\t\t: " GREEN "0x%.4lx\n" NORMAL, dwState); data/pcsc-lite-1.9.0/src/testpcsc.c:443:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("Current Reader Protocol\t\t: T=" GREEN "%ld\n" NORMAL, dwProt - 1); data/pcsc-lite-1.9.0/src/testpcsc.c:446:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("Current Reader ATR Value\t: " GREEN); data/pcsc-lite-1.9.0/src/testpcsc.c:452:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(NORMAL "\n"); data/pcsc-lite-1.9.0/src/winscard.c:1418:6: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy((char *)pbAttr, rContext->readerState->readerName); data/pcsc-lite-1.9.0/src/winscard_clnt.c:162:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, COLOR_GREEN "%c " COLOR_BLUE "[%lX] " COLOR_GREEN "%s ", data/pcsc-lite-1.9.0/src/winscard_clnt.c:165:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, COLOR_MAGENTA); data/pcsc-lite-1.9.0/src/winscard_clnt.c:167:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/pcsc-lite-1.9.0/src/winscard_clnt.c:170:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, COLOR_NORMAL "\n"); data/pcsc-lite-1.9.0/src/winscard_clnt.c:207:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s-%d", PROFILE_FILE, getuid()); data/pcsc-lite-1.9.0/src/winscard_clnt.c:211:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, COLOR_RED "Can't open %s: %s" COLOR_NORMAL "\n", data/pcsc-lite-1.9.0/src/winscard_clnt.c:250:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, COLOR_BLUE " WARNING: no start info for %s\n", f); data/pcsc-lite-1.9.0/src/winscard_clnt.c:262:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, data/pcsc-lite-1.9.0/src/winscard_clnt.c:267:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, COLOR_RED "RESULT %s " COLOR_MAGENTA "%ld" data/pcsc-lite-1.9.0/src/winscard_clnt.c:2911:4: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(buf, readerStates[i].readerName); data/pcsc-lite-1.9.0/src/debug.c:72:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. e = getenv("PCSCLITE_DEBUG"); data/pcsc-lite-1.9.0/src/debug.c:74:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. e = getenv("MUSCLECARD_DEBUG"); data/pcsc-lite-1.9.0/src/debug.c:84:10: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. term = getenv("TERM"); data/pcsc-lite-1.9.0/src/debuglog.c:264:10: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. term = getenv("TERM"); data/pcsc-lite-1.9.0/src/pcscdaemon.c:326:16: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt_long (argc, argv, OPT_STRING, long_options, &option_index)) != -1) { data/pcsc-lite-1.9.0/src/pcscdaemon.c:328:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt (argc, argv, OPT_STRING)) != -1) { data/pcsc-lite-1.9.0/src/readerfactory.c:175:26: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *ro_filter = getenv("PCSCLITE_FILTER_IGNORE_READER_NAMES"); data/pcsc-lite-1.9.0/src/readerfactory.c:591:11: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. extend = getenv("PCSCLITE_FILTER_EXTEND_READER_NAMES"); data/pcsc-lite-1.9.0/src/readerfactory.c:791:11: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. extend = getenv("PCSCLITE_FILTER_EXTEND_READER_NAMES"); data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:419:10: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. home = getenv("HOME"); data/pcsc-lite-1.9.0/src/sys_unix.c:127:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(myseed); data/pcsc-lite-1.9.0/src/winscard_clnt.c:572:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("PCSCLITE_NO_BLOCKING")) data/pcsc-lite-1.9.0/src/winscard_msg.c:94:19: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. socketNameEnv = getenv("PCSCLITE_CSOCK_NAME"); data/pcsc-lite-1.9.0/doc/example/pcsc_demo.c:60:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char pbReader[MAX_READERNAME] = ""; data/pcsc-lite-1.9.0/doc/example/pcsc_demo.c:124:15: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). reader_nb = atoi(argv[1]); data/pcsc-lite-1.9.0/src/PCSC/pcsclite.h:74:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char rgbAtr[MAX_ATR_SIZE]; data/pcsc-lite-1.9.0/src/auth.c:69:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char action_name[128]; data/pcsc-lite-1.9.0/src/configfile.c:2019:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[FILENAME_MAX]; data/pcsc-lite-1.9.0/src/configfile.c:2092:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). configFile = fopen(readerconf, "r"); data/pcsc-lite-1.9.0/src/debug.c:77:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). LogLevel = atoi(e); data/pcsc-lite-1.9.0/src/debug.c:106:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char DebugBuffer[DEBUG_BUF_SIZE]; data/pcsc-lite-1.9.0/src/debuglog.c:119:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char DebugBuffer[DEBUG_BUF_SIZE]; data/pcsc-lite-1.9.0/src/debuglog.c:210:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char DebugBuffer[len*3 + strlen(msg) +1]; data/pcsc-lite-1.9.0/src/debuglog.c:343:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char DebugBuffer[DEBUG_BUF_SIZE]; data/pcsc-lite-1.9.0/src/dyn_unix.c:87:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char pcFunctionName[256]; data/pcsc-lite-1.9.0/src/error.c:86:18: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static __thread char strError[75]; data/pcsc-lite-1.9.0/src/eventhandler.h:50:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char readerName[MAX_READERNAME]; /**< reader name */ data/pcsc-lite-1.9.0/src/hotplug_libudev.c:114:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fullPath[FILENAME_MAX]; data/pcsc-lite-1.9.0/src/hotplug_libudev.c:115:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fullLibPath[FILENAME_MAX]; data/pcsc-lite-1.9.0/src/hotplug_libudev.c:444:22: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). bInterfaceNumber = atoi(sInterfaceNumber); data/pcsc-lite-1.9.0/src/hotplug_libusb.c:118:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char bus_device[BUS_DEVICE_STRSIZE]; /**< device name */ data/pcsc-lite-1.9.0/src/hotplug_libusb.c:133:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fullPath[FILENAME_MAX]; data/pcsc-lite-1.9.0/src/hotplug_libusb.c:134:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fullLibPath[FILENAME_MAX]; data/pcsc-lite-1.9.0/src/hotplug_libusb.c:284:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char bus_device[BUS_DEVICE_STRSIZE]; data/pcsc-lite-1.9.0/src/hotplug_libusb.c:536:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char deviceName[MAX_DEVICENAME]; data/pcsc-lite-1.9.0/src/hotplug_libusb.c:583:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char serialNumber[MAX_READERNAME]; data/pcsc-lite-1.9.0/src/hotplug_libusb.c:597:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fullname[MAX_READERNAME]; data/pcsc-lite-1.9.0/src/hotplug_linux.c:125:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fullPath[FILENAME_MAX]; data/pcsc-lite-1.9.0/src/hotplug_linux.c:126:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fullLibPath[FILENAME_MAX]; data/pcsc-lite-1.9.0/src/hotplug_linux.c:239:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dirpath[FILENAME_MAX]; data/pcsc-lite-1.9.0/src/hotplug_linux.c:240:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[FILENAME_MAX]; data/pcsc-lite-1.9.0/src/hotplug_linux.c:307:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). deviceNumber = atoi(entryB->d_name); data/pcsc-lite-1.9.0/src/hotplug_linux.c:309:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(filename, O_RDONLY); data/pcsc-lite-1.9.0/src/hotplug_macosx.c:300:6: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char utf8_str[200]; data/pcsc-lite-1.9.0/src/hotplug_macosx.c:486:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char namebuf[1024]; data/pcsc-lite-1.9.0/src/hotplug_macosx.c:588:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char namebuf[1024]; data/pcsc-lite-1.9.0/src/hotplug_macosx.c:791:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char deviceName[MAX_DEVICENAME]; data/pcsc-lite-1.9.0/src/pcscdaemon.c:335:42: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). HPForceReaderPolling = optarg ? abs(atoi(optarg)) : 1; data/pcsc-lite-1.9.0/src/pcscdaemon.c:391:39: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). customMaxThreadCounter = optarg ? atoi(optarg) : 0; data/pcsc-lite-1.9.0/src/pcscdaemon.c:397:39: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). customMaxReaderHandles = optarg ? atoi(optarg) : 0; data/pcsc-lite-1.9.0/src/pcscdaemon.c:403:43: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). customMaxThreadCardHandles = optarg ? atoi(optarg) : 0; data/pcsc-lite-1.9.0/src/pcscdaemon.c:550:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open("/dev/null", O_RDWR); data/pcsc-lite-1.9.0/src/pcscdaemon.c:675:7: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = open(PCSCLITE_RUN_PID, O_RDWR | O_CREAT, mode); data/pcsc-lite-1.9.0/src/pcscdaemon.c:678:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char pid[PID_ASCII_SIZE]; data/pcsc-lite-1.9.0/src/readerfactory.c:233:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char lpcStripReader[MAX_READERNAME]; data/pcsc-lite-1.9.0/src/readerfactory.c:454:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(tmpReader, data/pcsc-lite-1.9.0/src/readerfactory.c:580:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char lpcStripReader[MAX_READERNAME]; data/pcsc-lite-1.9.0/src/readerfactory.c:1359:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char lpcStripReader[MAX_READERNAME]; data/pcsc-lite-1.9.0/src/readerfactory.c:1510:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char lpcStripReader[MAX_READERNAME]; data/pcsc-lite-1.9.0/src/simclist.c:520:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(lent->data, data, datalen); data/pcsc-lite-1.9.0/src/simclist.c:1129:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(filename, O_RDONLY, 0); data/pcsc-lite-1.9.0/src/simclist.c:1428:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(filename, oflag, mode); data/pcsc-lite-1.9.0/src/simclist.c:1440:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(filename, O_RDONLY, 0); data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:163:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char threadid[30]; data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:182:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line[256]; data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:184:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char threadid[30]; data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:263:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char log_buffer[length * 3 +1], *p; data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:409:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char log_pipe[128]; data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:424:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). Log_fd = open(log_pipe, O_WRONLY); data/pcsc-lite-1.9.0/src/testpcsc.c:87:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char pbAtr[MAX_ATR_SIZE]; data/pcsc-lite-1.9.0/src/testpcsc.c:90:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char as_char[100]; data/pcsc-lite-1.9.0/src/testpcsc.c:105:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char bSendBuffer[MAX_BUFFER_SIZE]; data/pcsc-lite-1.9.0/src/testpcsc.c:106:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char bRecvBuffer[MAX_BUFFER_SIZE]; data/pcsc-lite-1.9.0/src/testpcsc.c:208:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char input[80]; data/pcsc-lite-1.9.0/src/testpcsc.c:216:15: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). iReader = atoi(input); data/pcsc-lite-1.9.0/src/testpcsc.c:263:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(bSendBuffer, "\x00\xA4\x00\x00\x02\x3F\x00", send_length); data/pcsc-lite-1.9.0/src/testpcsc.c:281:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[1024] = "Foobar"; data/pcsc-lite-1.9.0/src/testpcsc.c:288:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[1024] = { 0x02 }; data/pcsc-lite-1.9.0/src/tokenparser.c:2092:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(elt->key, &pcToken[5], len-1); data/pcsc-lite-1.9.0/src/tokenparser.c:2124:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, &pcToken[8], len-1); data/pcsc-lite-1.9.0/src/tokenparser.c:2204:9: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). file = fopen(fileName, "r"); data/pcsc-lite-1.9.0/src/utils.c:61:7: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(PCSCLITE_RUN_PID, O_RDONLY); data/pcsc-lite-1.9.0/src/utils.c:64:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char pid_ascii[PID_ASCII_SIZE]; data/pcsc-lite-1.9.0/src/utils.c:75:10: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). pid = atoi(pid_ascii); data/pcsc-lite-1.9.0/src/winscard.c:150:8: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = fopen(PROFILE_FILE, "a+"); data/pcsc-lite-1.9.0/src/winscard_clnt.c:204:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[80]; data/pcsc-lite-1.9.0/src/winscard_clnt.c:208:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). profile_fd = fopen(filename, "a+"); data/pcsc-lite-1.9.0/src/winscard_clnt.c:1560:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(bufAtr, readerStates[i].cardAtr, min(*pcbAtrLen, dwAtrLen)); data/pcsc-lite-1.9.0/src/winscard_clnt.c:1925:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(currReader->rgbAtr, rContext->cardAtr, data/pcsc-lite-1.9.0/src/winscard_clnt.c:2540:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(scGetSetStruct.pbAttr, pbAttr, *pcbAttrLen); data/pcsc-lite-1.9.0/src/winscard_clnt.c:2581:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(pbAttr, scGetSetStruct.pbAttr, scGetSetStruct.cbAttrLen); data/pcsc-lite-1.9.0/src/winscard_clnt.c:3059:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, ReaderGroup, dwGroups); data/pcsc-lite-1.9.0/src/winscard_msg.c:87:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char socketName[member_size(struct sockaddr_un, sun_path)]; data/pcsc-lite-1.9.0/src/winscard_msg.h:144:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char szReader[MAX_READERNAME]; data/pcsc-lite-1.9.0/src/winscard_svc.c:639:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char pbSendBuffer[MAX_BUFFER_SIZE_EXTENDED]; data/pcsc-lite-1.9.0/src/winscard_svc.c:640:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char pbRecvBuffer[MAX_BUFFER_SIZE_EXTENDED]; data/pcsc-lite-1.9.0/src/winscard_svc.c:696:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char pbSendBuffer[MAX_BUFFER_SIZE_EXTENDED]; data/pcsc-lite-1.9.0/src/winscard_svc.c:697:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char pbRecvBuffer[MAX_BUFFER_SIZE_EXTENDED]; data/pcsc-lite-1.9.0/doc/example/pcsc_demo.c:93:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). ptr += strlen(ptr)+1; data/pcsc-lite-1.9.0/doc/example/pcsc_demo.c:118:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). ptr += strlen(ptr)+1; data/pcsc-lite-1.9.0/src/configfile.c:625:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/pcsc-lite-1.9.0/src/configfile.c:1550:37: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return yy_scan_bytes( yystr, (int) strlen(yystr) ); data/pcsc-lite-1.9.0/src/configfile.c:1837:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). pcFriendlyname = malloc(strlen(pcCurrent) + 1); data/pcsc-lite-1.9.0/src/configfile.c:1838:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). for (n = 0, p = 0; n < strlen(pcCurrent); n++) data/pcsc-lite-1.9.0/src/debuglog.c:210:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char DebugBuffer[len*3 + strlen(msg) +1]; data/pcsc-lite-1.9.0/src/debuglog.c:216:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). c = DebugBuffer + strlen(DebugBuffer); data/pcsc-lite-1.9.0/src/error.c:232:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(strError, msg, sizeof(strError)); data/pcsc-lite-1.9.0/src/hotplug_libusb.c:468:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(rescan_pipe[0], &dummy, sizeof(dummy)) > 0) data/pcsc-lite-1.9.0/src/hotplug_libusb.c:508:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(pipefd[0], &c, 1); data/pcsc-lite-1.9.0/src/hotplug_libusb.c:567:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(readerTracker[i].bus_device, bus_device, data/pcsc-lite-1.9.0/src/hotplug_linux.c:277:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). entry->d_name[strlen(entry->d_name) - 1])) data/pcsc-lite-1.9.0/src/hotplug_linux.c:313:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, (void *) &usbDescriptor, data/pcsc-lite-1.9.0/src/pcscdaemon.c:186:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(signal_handler_fd[0], &sig, sizeof sig); data/pcsc-lite-1.9.0/src/pcscdaemon.c:572:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(pipefd[0], &buf, 1); data/pcsc-lite-1.9.0/src/pcscdaemon.c:682:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). rr = write(f, pid, strlen(pid) + 1); data/pcsc-lite-1.9.0/src/readerfactory.c:181:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). filter = alloca(strlen(ro_filter)+1); data/pcsc-lite-1.9.0/src/readerfactory.c:214:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). readerName = alloca(strlen(readerNameLong)+1); data/pcsc-lite-1.9.0/src/readerfactory.c:218:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(readerName) > MAX_READERNAME - sizeof(" 00 00")) data/pcsc-lite-1.9.0/src/readerfactory.c:222:4: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(readerName), MAX_READERNAME - sizeof(" 00 00")); data/pcsc-lite-1.9.0/src/readerfactory.c:237:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(lpcStripReader, data/pcsc-lite-1.9.0/src/readerfactory.c:240:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). tmplen = strlen(lpcStripReader); data/pcsc-lite-1.9.0/src/readerfactory.c:457:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). snprintf(tmpReader + strlen(tmpReader) - 2, 3, "%02X", j); data/pcsc-lite-1.9.0/src/readerfactory.c:593:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). extend_size = strlen(extend); data/pcsc-lite-1.9.0/src/readerfactory.c:600:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(lpcStripReader, data/pcsc-lite-1.9.0/src/readerfactory.c:603:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). lpcStripReader[strlen(lpcStripReader) - 6 - extend_size] = 0; data/pcsc-lite-1.9.0/src/readerfactory.c:752:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). currentDigit = strtol(reader + strlen(reader) - 5, NULL, 16); data/pcsc-lite-1.9.0/src/readerfactory.c:1364:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(lpcStripReader, data/pcsc-lite-1.9.0/src/readerfactory.c:1368:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). lpcStripReader[strlen(lpcStripReader) - 6] = '\0'; data/pcsc-lite-1.9.0/src/readerfactory.c:1514:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(lpcStripReader, data/pcsc-lite-1.9.0/src/readerfactory.c:1517:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). tmplen = strlen(lpcStripReader); data/pcsc-lite-1.9.0/src/simclist.c:98:57: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, msgbuf, msglen) != msglen) { \ data/pcsc-lite-1.9.0/src/simclist.c:1513:51: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t list_meter_string(const void *el) { return strlen((const char *)el) + 1; } data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:172:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). r = write(Log_fd, threadid, strlen(threadid)); data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:173:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). r = write(Log_fd, line, strlen(line)); data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:201:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). r = write(Log_fd, threadid, strlen(threadid)); data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:308:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). length += strlen(s)+1; data/pcsc-lite-1.9.0/src/spy/libpcscspy.c:309:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). s += strlen(s)+1; data/pcsc-lite-1.9.0/src/testpcsc.c:467:8: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (void)getchar(); data/pcsc-lite-1.9.0/src/tokenparser.c:898:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/pcsc-lite-1.9.0/src/tokenparser.c:1822:37: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return yy_scan_bytes( yystr, (int) strlen(yystr) ); data/pcsc-lite-1.9.0/src/utils.c:67:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, pid_ascii, sizeof pid_ascii); data/pcsc-lite-1.9.0/src/winscard.c:1412:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). unsigned int len = strlen(rContext->readerState->readerName)+1; data/pcsc-lite-1.9.0/src/winscard_clnt.c:828:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(szReader) > MAX_READERNAME) data/pcsc-lite-1.9.0/src/winscard_clnt.c:839:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(scConnectStruct.szReader, szReader, sizeof scConnectStruct.szReader); data/pcsc-lite-1.9.0/src/winscard_clnt.c:1499:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). *pcchReaderLen = strlen(pChannelMap->readerName) + 1; data/pcsc-lite-1.9.0/src/winscard_clnt.c:1533:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(bufReader, pChannelMap->readerName, dwReaderLen); data/pcsc-lite-1.9.0/src/winscard_clnt.c:2863:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). dwReadersLen += strlen(readerStates[i].readerName) + 1; data/pcsc-lite-1.9.0/src/winscard_clnt.c:2912:11: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). buf += strlen(readerStates[i].readerName)+1; data/pcsc-lite-1.9.0/src/winscard_msg.c:96:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(socketName, socketNameEnv, sizeof(socketName)); data/pcsc-lite-1.9.0/src/winscard_msg.c:98:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(socketName, PCSCLITE_CSOCK_NAME, sizeof(socketName)); data/pcsc-lite-1.9.0/src/winscard_msg.c:138:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(svc_addr.sun_path, socketName, sizeof(svc_addr.sun_path)); data/pcsc-lite-1.9.0/src/winscard_msg.c:141:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). sizeof(svc_addr.sun_family) + strlen(svc_addr.sun_path) + 1) < 0) data/pcsc-lite-1.9.0/src/winscard_msg.c:251:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). readed = read(filedes, buffer, remaining); data/pcsc-lite-1.9.0/src/winscard_msg.c:491:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). readed = read(filedes, buffer, remaining); data/pcsc-lite-1.9.0/src/winscard_msg_srv.c:143:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sa.un.sun_path, PCSCLITE_CSOCK_NAME, sizeof sa.un.sun_path); ANALYSIS SUMMARY: Hits = 204 Lines analyzed = 27708 in approximately 0.74 seconds (37509 lines/second) Physical Source Lines of Code (SLOC) = 16254 Hits@level = [0] 201 [1] 57 [2] 85 [3] 13 [4] 47 [5] 2 Hits@level+ = [0+] 405 [1+] 204 [2+] 147 [3+] 62 [4+] 49 [5+] 2 Hits/KSLOC@level+ = [0+] 24.9169 [1+] 12.5508 [2+] 9.04393 [3+] 3.81445 [4+] 3.01464 [5+] 0.123047 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.