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/usbview-2.0-21-g6fe2f4f/callbacks.c Examining data/usbview-2.0-21-g6fe2f4f/configure-dialog.c Examining data/usbview-2.0-21-g6fe2f4f/interface.c Examining data/usbview-2.0-21-g6fe2f4f/main.c Examining data/usbview-2.0-21-g6fe2f4f/usbparse.c Examining data/usbview-2.0-21-g6fe2f4f/usbparse.h Examining data/usbview-2.0-21-g6fe2f4f/usbtree.c Examining data/usbview-2.0-21-g6fe2f4f/usbtree.h FINAL RESULTS: data/usbview-2.0-21-g6fe2f4f/configure-dialog.c:92: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 (devicesFile, editString); data/usbview-2.0-21-g6fe2f4f/usbparse.c:536: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 (device->name, device->product); data/usbview-2.0-21-g6fe2f4f/usbparse.c:571:10: [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 (device->name, interface->name); data/usbview-2.0-21-g6fe2f4f/usbtree.c:93:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (string, "\nManufacturer: %s", device->manufacturer); data/usbview-2.0-21-g6fe2f4f/usbtree.c:99:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (string, "\nSerial Number: %s", device->serialNumber); data/usbview-2.0-21-g6fe2f4f/usbtree.c:112:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (string, "\nSpeed: %s", tempString); data/usbview-2.0-21-g6fe2f4f/usbtree.c:143:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (string, "\nUSB Version: %s\nDevice Class: %s\nDevice Subclass: %s\nDevice Protocol: %s\n" data/usbview-2.0-21-g6fe2f4f/usbtree.c:152:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (string, "\nVendor Id: %.4x\nProduct Id: %.4x\nRevision Number: %s", data/usbview-2.0-21-g6fe2f4f/usbtree.c:163:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (string, "\n\nConfig Number: %i\n\tNumber of Interfaces: %i\n\t" data/usbview-2.0-21-g6fe2f4f/usbtree.c:178:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (string, "\n\t\tName: %s", interface->name); data/usbview-2.0-21-g6fe2f4f/usbtree.c:182:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (string, "\n\t\tAlternate Number: %i\n\t\tClass: %s\n\t\t" data/usbview-2.0-21-g6fe2f4f/usbtree.c:193:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (string, "\n\n\t\t\tEndpoint Address: %.2x\n\t\t\t" data/usbview-2.0-21-g6fe2f4f/usbtree.c:332: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 (previousDevicesFile, devicesFile); data/usbview-2.0-21-g6fe2f4f/usbparse.c:510: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 (endpoint->type, &data[20], ENDPOINT_TYPE_SIZE-1); data/usbview-2.0-21-g6fe2f4f/usbparse.c:542: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 (device->name, "root hub"); data/usbview-2.0-21-g6fe2f4f/usbparse.c:559:13: [2] (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 string. strcat (device->name, "keyboard"); data/usbview-2.0-21-g6fe2f4f/usbparse.c:562:13: [2] (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 string. strcat (device->name, "mouse"); data/usbview-2.0-21-g6fe2f4f/usbparse.c:569:11: [2] (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 string. strcat (device->name, " / "); data/usbview-2.0-21-g6fe2f4f/usbparse.c:581:4: [2] (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 string. strcat (device->name, "Unknown Device"); data/usbview-2.0-21-g6fe2f4f/usbtree.c:116: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 (string, "\nBus:%4d", busNumber); data/usbview-2.0-21-g6fe2f4f/usbtree.c:120: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 (string, "\nAddress:%4d", deviceNumber); data/usbview-2.0-21-g6fe2f4f/usbtree.c:125: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 (string, "\nNumber of Ports: %i", device->maxChildren); data/usbview-2.0-21-g6fe2f4f/usbtree.c:131: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 (string, "\nBandwidth allocated: %i / %i (%i%%)", device->bandwidth->allocated, device->bandwidth->total, device->bandwidth->percent); data/usbview-2.0-21-g6fe2f4f/usbtree.c:134: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 (string, "\nTotal number of interrupt requests: %i", device->bandwidth->numInterruptRequests); data/usbview-2.0-21-g6fe2f4f/usbtree.c:137: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 (string, "\nTotal number of isochronous requests: %i", device->bandwidth->numIsocRequests); data/usbview-2.0-21-g6fe2f4f/usbtree.c:174:6: [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 (string, "\n\n\tInterface Number: %i", interface->interfaceNumber); data/usbview-2.0-21-g6fe2f4f/usbtree.c:352:12: [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). usbFile = fopen (devicesFile, "r"); data/usbview-2.0-21-g6fe2f4f/usbtree.c:400: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 (devicesFile, "/sys/kernel/debug/usb/devices"); data/usbview-2.0-21-g6fe2f4f/usbparse.c:46: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). pointer += strlen(pattern); data/usbview-2.0-21-g6fe2f4f/usbparse.c:73: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). pointer += strlen(pattern); data/usbview-2.0-21-g6fe2f4f/usbparse.c:74:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (dest, pointer, maxSize); data/usbview-2.0-21-g6fe2f4f/usbparse.c:568: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). if (strlen (device->name) > 0) { data/usbview-2.0-21-g6fe2f4f/usbparse.c:580: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 (device->name) == 0) { data/usbview-2.0-21-g6fe2f4f/usbparse.c:621: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). line[strlen(line)-1] = 0x00; data/usbview-2.0-21-g6fe2f4f/usbtree.c:88:72: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, device->name,strlen(device->name)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:94:66: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:100:66: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:113:65: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:117:65: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:121:65: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:126:66: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:132:66: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:135:66: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:138:66: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:147:66: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:154:66: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:167:67: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:175:70: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string, strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:179:71: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string, strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:186:70: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string, strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:199:71: [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). gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string)); data/usbview-2.0-21-g6fe2f4f/usbtree.c:366: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). && dataLine[strlen(dataLine)-1] == '\n') { ANALYSIS SUMMARY: Hits = 52 Lines analyzed = 1678 in approximately 0.05 seconds (30841 lines/second) Physical Source Lines of Code (SLOC) = 1123 Hits@level = [0] 2 [1] 24 [2] 15 [3] 0 [4] 13 [5] 0 Hits@level+ = [0+] 54 [1+] 52 [2+] 28 [3+] 13 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 48.0855 [1+] 46.3045 [2+] 24.9332 [3+] 11.5761 [4+] 11.5761 [5+] 0 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.