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/system-config-printer-1.5.12/udev/udev-configure-printer.c FINAL RESULTS: data/system-config-printer-1.5.12/udev/udev-configure-printer.c:289:8: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog (LOG_ERR, "failed to create " USB_URI_MAP); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:308:7: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog (LOG_ERR, "failed to lock " USB_URI_MAP); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:330:7: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog (LOG_ERR, "failed to read " USB_URI_MAP); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1704:7: [4] (shell) execv: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execv (argv0, argv); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:272: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). int fd = open (USB_URI_MAP, O_RDWR); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:286:9: [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 (USB_URI_MAP, O_RDWR | O_TRUNC | O_CREAT, 0644); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:477: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 (id->full_device_id, device_id, len); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:493:7: [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 (fieldname, start, len); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:595: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 libusbserial[1024]; data/system-config-printer-1.5.12/udev/udev-configure-printer.c:596: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 ieee1284_id[1024]; data/system-config-printer-1.5.12/udev/udev-configure-printer.c:760: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 (syspath, "/sys", syslen); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:761: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 (syspath + syslen, devpath, devpathlen); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:770: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 (devicefilepath, syspath, syslen + devpathlen); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:771: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 (devicefilepath + syslen + devpathlen, "/usb", 4); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1361: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 usblpdevstr1[32] = "", usblpdevstr2[32] = ""; data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1597: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 usbserial[256]; data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1598: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 usblpdev[8] = ""; data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1669:7: [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 argv0[PATH_MAX]; data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1788: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 usblpdev[8] = ""; data/system-config-printer-1.5.12/udev/udev-configure-printer.c:328:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read (fd, buf, st.st_size) < 0) data/system-config-printer-1.5.12/udev/udev-configure-printer.c:462: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). len = strlen (device_id); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:752: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). syslen = strlen ("/sys"); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:753:16: [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). devpathlen = strlen (devpath); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:834:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (usbserial, serial, usbseriallen); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1079: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). size_t len = strlen (device_uri_types[i]); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1294: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). for (i = 0, j = 0; i < strlen(str); i++, j++) data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1306:33: [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 ((str[i] == '%') && (i <= strlen(str)-3) && data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1328: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). while (str[strlen(str)-1] == ' ') data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1329: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). str[strlen(str)-1] = '\0'; data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1394: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(usblpdev) > 0) data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1466: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). l = strlen(device_uris->uri[i]); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1468: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). l = strlen(this_device_uri); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1470: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). l = strlen(device_uris->uri[i]); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1472: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). l = strlen(this_device_uri); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1473: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(this_device_uri) > strlen(device_uris->uri[i])) data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1473:39: [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(this_device_uri) > strlen(device_uris->uri[i])) data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1474: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). l = strlen(this_device_uri); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1476: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). l = strlen(device_uris->uri[i]); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1481: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). if (i == 0 && strlen(usblpdev) > 0) data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1494: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). ((strlen(usblpdev) > 0) && data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1565: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 (bdaddr) != 17) data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1576: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 (elems[i]) != 2 || data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1695:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (argv0, cmd, sizeof (argv0)); data/system-config-printer-1.5.12/udev/udev-configure-printer.c:1701:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy (p, "udev-add-printer", sizeof (argv0) - (p - argv0)); ANALYSIS SUMMARY: Hits = 44 Lines analyzed = 1876 in approximately 0.09 seconds (20856 lines/second) Physical Source Lines of Code (SLOC) = 1480 Hits@level = [0] 73 [1] 25 [2] 15 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 117 [1+] 44 [2+] 19 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 79.0541 [1+] 29.7297 [2+] 12.8378 [3+] 2.7027 [4+] 2.7027 [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.