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/usb-modeswitch-2.6.1/usb_modeswitch.c Examining data/usb-modeswitch-2.6.1/usb_modeswitch.h Examining data/usb-modeswitch-2.6.1/dispatcher.c FINAL RESULTS: data/usb-modeswitch-2.6.1/dispatcher.c:63:3: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(arglist,arg,MAX_ARGSIZE-1); data/usb-modeswitch-2.6.1/dispatcher.c:62:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(arg,"{%s} ",argv[i]); data/usb-modeswitch-2.6.1/dispatcher.c:67:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(code, "set argv {%s}\nset argc %d\n", arglist, argc-1); data/usb-modeswitch-2.6.1/usb_modeswitch.c:112:42: [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. #define SHOW_PROGRESS if (show_progress) fprintf data/usb-modeswitch-2.6.1/usb_modeswitch.c:409:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(longConfig,optarg); data/usb-modeswitch-2.6.1/usb_modeswitch.c:744: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(Messages[4], MessageContent); data/usb-modeswitch-2.6.1/usb_modeswitch.c:764: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(Messages[0],MessageContent); data/usb-modeswitch-2.6.1/usb_modeswitch.c:766: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(Messages[1], MessageContent2); data/usb-modeswitch-2.6.1/usb_modeswitch.c:768: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(Messages[2], MessageContent3); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1751: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(listcopy, productList); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1935: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(ConfigBuffer[numLines],Str); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1952: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(Str,ConfigBuffer[Line]); data/usb-modeswitch-2.6.1/usb_modeswitch.h:95: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(Str, TempPP); else Str[0]='\0' data/usb-modeswitch-2.6.1/usb_modeswitch.c:351:7: [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. c = getopt_long (argc, argv, "hejWQDndKHJSOBEGTNALZUXF:RItv:p:V:P:C:m:M:2:3:w:r:c:i:u:a:s:f:b:g:", data/usb-modeswitch-2.6.1/dispatcher.c:45: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 arg[MAX_ARGSIZE]; data/usb-modeswitch-2.6.1/dispatcher.c:46: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 arglist[MAX_ARGSIZE]; data/usb-modeswitch-2.6.1/dispatcher.c:66: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 code[script_size + sizeof(arglist) + 28]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:150:1: [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 MessageContent[LINE_DIM]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:151:1: [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 MessageContent2[LINE_DIM]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:152:1: [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 MessageContent3[LINE_DIM]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:153:1: [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 TargetProductList[LINE_DIM]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:154:1: [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 DefaultProductList[5]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:155:10: [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 ByteString[LINE_DIM/2]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:156:10: [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 buffer[BUF_SIZE]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:408:5: [2] (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). Risk is low because the source is a constant string. strcpy(longConfig,"##\n"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:507:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(TargetProductList,"%04x",TargetProduct); data/usb-modeswitch-2.6.1/usb_modeswitch.c:541:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(DefaultProductList,"%04x",DefaultProduct); data/usb-modeswitch-2.6.1/usb_modeswitch.c:739:3: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[0],"5553424387654321000000000000061e000000000000000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:740:3: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[1],"5553424397654321000000000000061b000000020000000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:741:3: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[2],"5553424387654321000000000001061e000000000000000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:742:3: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[3],"5553424397654321000000000001061b000000020000000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:750:3: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[0],"55534243123456780000000000000011062000000101000100000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:755:3: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[0],"55534243123456780000000000000011063000000000010000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:760:3: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[0],"55534243123456780000000000000601000000000000000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:848: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 imanufact[DESCR_MAX], iproduct[DESCR_MAX], iserial[DESCR_MAX]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:866:4: [2] (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). Risk is low because the source is a constant string. strcpy(imanufact, "read error"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:869:3: [2] (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). Risk is low because the source is a constant string. strcpy(imanufact, "not provided"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:878:4: [2] (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). Risk is low because the source is a constant string. strcpy(iproduct, "read error"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:881:3: [2] (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). Risk is low because the source is a constant string. strcpy(iproduct, "not provided"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:890:4: [2] (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). Risk is low because the source is a constant string. strcpy(iserial, "read error"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:893:3: [2] (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). Risk is low because the source is a constant string. strcpy(iserial, "not provided"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1194: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(buffer, "\x05\x8c\x04\x08\xa0\xee\x20\x00\x5c\x01\x04\x08\x98\xcd\xea\xbf", 16); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1266: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(buffer, "\xb0\x04\x00\x00\x02\x90\x26\x86", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1270: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(buffer, "\xb0\x04\x00\x00\x02\x90\x26\x86", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1276: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(buffer, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1279: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(buffer, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1282: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(buffer, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1287: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(buffer, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1290: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(buffer, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1293: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(buffer, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1298: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(buffer, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1301: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(buffer, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", SIZE); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1340:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[0],"55534243f83bcd810002000080000afd000000030000000100000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1341:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[1],"55534243984300820002000080000afd000000070000000100000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1342:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[2],"55534243984300820000000000000afd000100071000000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1343:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[3],"55534243984300820002000080000afd000200230000000100000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1344:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[4],"55534243984300820000000000000afd000300238200000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1345:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[5],"55534243984300820002000080000afd000200260000000100000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1346:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[6],"55534243984300820000000000000afd00030026c800000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1347:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[7],"55534243d84c04820002000080000afd000010730000000100000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1348:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[8],"55534243d84c04820002000080000afd000200240000000100000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1349:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[9],"55534243d84c04820000000000000afd000300241300000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1350:2: [2] (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). Risk is low because the source is a constant string. strcpy(Messages[10],"55534243d84c04820000000000000afd000110732400000000000000000000"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1707: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 buffer[2]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:1895: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 Str[LINE_DIM]; data/usb-modeswitch-2.6.1/usb_modeswitch.c:1913:10: [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/usb-modeswitch-2.6.1/usb_modeswitch.h:99:7: [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). Int=atoi(TempPP) data/usb-modeswitch-2.6.1/dispatcher.c:54:7: [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(argv[i]) > MAX_ARGSIZE-4) { data/usb-modeswitch-2.6.1/dispatcher.c:58:9: [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(arglist) + strlen(argv[i])) > MAX_ARGSIZE-4) { data/usb-modeswitch-2.6.1/dispatcher.c:58: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). if ( (strlen(arglist) + strlen(argv[i])) > MAX_ARGSIZE-4) { data/usb-modeswitch-2.6.1/dispatcher.c:68:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(code, RAWSCRIPT, script_size); data/usb-modeswitch-2.6.1/usb_modeswitch.c:279:7: [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(TargetProductList) ) data/usb-modeswitch-2.6.1/usb_modeswitch.c:317:7: [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(MessageContent) ) data/usb-modeswitch-2.6.1/usb_modeswitch.c:319:7: [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(MessageContent2) ) data/usb-modeswitch-2.6.1/usb_modeswitch.c:321:7: [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(MessageContent3) ) data/usb-modeswitch-2.6.1/usb_modeswitch.c:367:14: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). case 'M': strncpy(MessageContent, optarg, LINE_DIM); break; data/usb-modeswitch-2.6.1/usb_modeswitch.c:368:14: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). case '2': strncpy(MessageContent2, optarg, LINE_DIM); break; data/usb-modeswitch-2.6.1/usb_modeswitch.c:369:14: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). case '3': strncpy(MessageContent3, optarg, LINE_DIM); break; data/usb-modeswitch-2.6.1/usb_modeswitch.c:407:25: [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). longConfig = malloc(strlen(optarg)+5); data/usb-modeswitch-2.6.1/usb_modeswitch.c:410:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(longConfig,"\n"); data/usb-modeswitch-2.6.1/usb_modeswitch.c:480: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(MessageContent)) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:481:7: [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(MessageContent) % 2 != 0) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:485:47: [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 ( hexstr2bin(MessageContent, ByteString, strlen(MessageContent)/2) == -1) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:606:7: [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(MessageContent) && strncmp("55534243",MessageContent,8) == 0) data/usb-modeswitch-2.6.1/usb_modeswitch.c:616: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(MessageContent) || StandardEject || ModeMap & CISCO_MODE data/usb-modeswitch-2.6.1/usb_modeswitch.c:656:7: [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(MessageContent) || StandardEject) && ModeMap ) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:662: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). if (StandardEject && (strlen(MessageContent2) || strlen(MessageContent3))) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:662: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). if (StandardEject && (strlen(MessageContent2) || strlen(MessageContent3))) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:666: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). if ( !ModeMap && !strlen(MessageContent) && AltSetting == -1 && !Configuration && !StandardEject ) data/usb-modeswitch-2.6.1/usb_modeswitch.c:762:13: [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). } else if (strlen(MessageContent)) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:1017:8: [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(Messages[i]) == 0) data/usb-modeswitch-2.6.1/usb_modeswitch.c:1053:2: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(50000); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1057:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(ReleaseDelay*1000); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1086:2: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100000); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1385:2: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(ReleaseDelay*1000); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1523: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(message) % 2 != 0) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:1527: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). message_length = strlen(message) / 2; data/usb-modeswitch-2.6.1/usb_modeswitch.c:1714: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). if ( targetClass && !(vendor || strlen(productList)) ) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:1724: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). listcopy = malloc(strlen(productList)+1); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1754:8: [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(token) != 4) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:1760:35: [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 ( hexstr2bin(token, buffer, strlen(token)/2) == -1) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:1906:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Str,token,LINE_DIM-1); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1923:8: [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). Len=strlen(Str); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1933:8: [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). Len=strlen(Str)+1; data/usb-modeswitch-2.6.1/usb_modeswitch.c:1941:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Str,token,LINE_DIM-1); data/usb-modeswitch-2.6.1/usb_modeswitch.c:1972:12: [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 (Pos==strlen(Str)) { data/usb-modeswitch-2.6.1/usb_modeswitch.c:1984:12: [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 (Pos==strlen(Equal)) { ANALYSIS SUMMARY: Hits = 107 Lines analyzed = 2341 in approximately 0.10 seconds (24593 lines/second) Physical Source Lines of Code (SLOC) = 1839 Hits@level = [0] 114 [1] 40 [2] 53 [3] 1 [4] 12 [5] 1 Hits@level+ = [0+] 221 [1+] 107 [2+] 67 [3+] 14 [4+] 13 [5+] 1 Hits/KSLOC@level+ = [0+] 120.174 [1+] 58.1838 [2+] 36.4328 [3+] 7.61283 [4+] 7.06906 [5+] 0.543774 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.