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/xautolock-2.2/src/message.c Examining data/xautolock-2.2/src/state.c Examining data/xautolock-2.2/src/diy.c Examining data/xautolock-2.2/src/xautolock.c Examining data/xautolock-2.2/src/engine.c Examining data/xautolock-2.2/src/options.c Examining data/xautolock-2.2/include/state.h Examining data/xautolock-2.2/include/version.h Examining data/xautolock-2.2/include/message.h Examining data/xautolock-2.2/include/miscutil.h Examining data/xautolock-2.2/include/engine.h Examining data/xautolock-2.2/include/options.h Examining data/xautolock-2.2/include/diy.h Examining data/xautolock-2.2/include/config.h FINAL RESULTS: data/xautolock-2.2/include/miscutil.h:36:33: [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 error0(s) ((void) fprintf (stderr, (s))) data/xautolock-2.2/include/miscutil.h:37:33: [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 error1(s,a1) ((void) fprintf (stderr, (s), (a1))) data/xautolock-2.2/include/miscutil.h:38:33: [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 error2(s,a1,a2) ((void) fprintf (stderr, (s), (a1), (a2))) data/xautolock-2.2/src/engine.c:316:26: [4] (shell) system: 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. { int dummy; dummy = system (killer); } // Silly gcc... data/xautolock-2.2/src/engine.c:332:28: [4] (shell) system: 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. { int dummy; dummy = system (notifier); } // Silly gcc... data/xautolock-2.2/src/engine.c:374:18: [4] (shell) execl: 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. (void) execl ("/bin/sh", "/bin/sh", "-c", data/xautolock-2.2/src/message.c:107:5: [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 (argArray[0], argArray); data/xautolock-2.2/src/message.c:213:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (sem, "%s%s", progName, SEM_PID); data/xautolock-2.2/src/message.c:219:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (mes, "%s%s", progName, MESSAGE); data/xautolock-2.2/src/options.c:263:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (tmp = newArray (char, strlen (*command) + 6), data/xautolock-2.2/src/options.c:272:10: [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). (void) strcpy (tmp, *command); data/xautolock-2.2/src/options.c:358:14: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (tmp = newArray (char, strlen (notifier) + 3), data/xautolock-2.2/src/options.c:378:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (tmp = newArray (char, strlen (killer) + 3), data/xautolock-2.2/src/options.c:714:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (path, "%s/.Xdefaults", home); data/xautolock-2.2/src/options.c:729:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (xoptions[j].option = newArray (char, l + 1), data/xautolock-2.2/src/options.c:731:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (xoptions[j].specifier = newArray (char, l + 1), data/xautolock-2.2/src/options.c:756:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (fullname, "%s%s", progName, xoptions[j].specifier); data/xautolock-2.2/src/options.c:779:14: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (fullname, "%s%s", APPLIC_CLASS, xoptions[j].specifier); data/xautolock-2.2/src/options.c:670: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. else if ((str = getenv ("XENVIRONMENT"))) /* = intended */ data/xautolock-2.2/src/options.c:709:14: [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/xautolock-2.2/include/config.h:72:9: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. #define vfork fork data/xautolock-2.2/src/engine.c:355:27: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. switch (lockerPid = vfork ()) data/xautolock-2.2/src/message.c:212: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). sem = newArray (char, strlen (progName) + strlen (SEM_PID) + 1); data/xautolock-2.2/src/message.c:212:45: [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). sem = newArray (char, strlen (progName) + strlen (SEM_PID) + 1); data/xautolock-2.2/src/message.c:218: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). mes = newArray (char, strlen (progName) + strlen (MESSAGE) + 1); data/xautolock-2.2/src/message.c:218:45: [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). mes = newArray (char, strlen (progName) + strlen (MESSAGE) + 1); data/xautolock-2.2/src/options.c:165: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 (arg) != 4) return False; data/xautolock-2.2/src/options.c:263:43: [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). (void) sprintf (tmp = newArray (char, strlen (*command) + 6), data/xautolock-2.2/src/options.c:271:31: [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* tmp = newArray (char, strlen (*command) + 1); data/xautolock-2.2/src/options.c:317: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). lockerDescr.dsc$w_length = (unsigned short) strlen (locker); data/xautolock-2.2/src/options.c:333:50: [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). nowLockerDescr.dsc$w_length = (unsigned short) strlen (now_locker); data/xautolock-2.2/src/options.c:358:45: [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). (void) sprintf (tmp = newArray (char, strlen (notifier) + 3), data/xautolock-2.2/src/options.c:378:43: [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). (void) sprintf (tmp = newArray (char, strlen (killer) + 3), data/xautolock-2.2/src/options.c:552: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 ("Usage : ") + strlen (progName); data/xautolock-2.2/src/options.c:552:32: [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 ("Usage : ") + strlen (progName); data/xautolock-2.2/src/options.c:713: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). path = newArray (char, strlen (home) + strlen ("/.Xdefaults") + 1); data/xautolock-2.2/src/options.c:713:44: [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). path = newArray (char, strlen (home) + strlen ("/.Xdefaults") + 1); data/xautolock-2.2/src/options.c:726: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). l = strlen (options[j].name) + 1; data/xautolock-2.2/src/options.c:745: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). unsigned classLen = strlen (APPLIC_CLASS); data/xautolock-2.2/src/options.c:746: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). unsigned progLen = strlen (progName); ANALYSIS SUMMARY: Hits = 40 Lines analyzed = 2421 in approximately 0.08 seconds (31855 lines/second) Physical Source Lines of Code (SLOC) = 1493 Hits@level = [0] 1 [1] 18 [2] 2 [3] 2 [4] 18 [5] 0 Hits@level+ = [0+] 41 [1+] 40 [2+] 22 [3+] 20 [4+] 18 [5+] 0 Hits/KSLOC@level+ = [0+] 27.4615 [1+] 26.7917 [2+] 14.7354 [3+] 13.3958 [4+] 12.0563 [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.