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/xwatch-2.11/src/addfile.c Examining data/xwatch-2.11/src/alarmhandler.c Examining data/xwatch-2.11/src/ui.h Examining data/xwatch-2.11/src/error.c Examining data/xwatch-2.11/src/parsegeometry.c Examining data/xwatch-2.11/src/checksetting.c Examining data/xwatch-2.11/src/scanfile.c Examining data/xwatch-2.11/src/usage.c Examining data/xwatch-2.11/src/warning.c Examining data/xwatch-2.11/src/flres.h Examining data/xwatch-2.11/src/settings.h Examining data/xwatch-2.11/src/getcolorindex.c Examining data/xwatch-2.11/src/strerror.c Examining data/xwatch-2.11/src/xmalloc.c Examining data/xwatch-2.11/src/xrealloc.c Examining data/xwatch-2.11/src/parsegag.c Examining data/xwatch-2.11/src/xstrdup.c Examining data/xwatch-2.11/src/parsecolorstring.c Examining data/xwatch-2.11/src/parseignore.c Examining data/xwatch-2.11/src/parsecolors.c Examining data/xwatch-2.11/src/colorname2index.c Examining data/xwatch-2.11/src/addline.c Examining data/xwatch-2.11/src/xwatch.c Examining data/xwatch-2.11/src/colorname2rgb.c Examining data/xwatch-2.11/src/ui.c Examining data/xwatch-2.11/src/xwatch.h FINAL RESULTS: data/xwatch-2.11/src/addfile.c:58:5: [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 (fname, filename); /* get filename */ data/xwatch-2.11/src/addline.c:130:17: [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(outbuf, cp); data/xwatch-2.11/src/addline.c:157:6: [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 (outbuf, cp); data/xwatch-2.11/src/addline.c:164:9: [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 (outbuf, cp); data/xwatch-2.11/src/colorname2rgb.c:77: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). strcpy (dummy, dummy + 1); data/xwatch-2.11/src/error.c:38:5: [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/xwatch-2.11/src/parsecolorstring.c:52:13: [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, str + 1); data/xwatch-2.11/src/parsecolorstring.c:62:17: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. if (sscanf (str,"%[^:]:%s", colorname, matchstr) > 1 && data/xwatch-2.11/src/parsegag.c:46:13: [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, str + 1); data/xwatch-2.11/src/scanfile.c:107:2: [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 (buf, finfo [i].name); data/xwatch-2.11/src/warning.c:39:5: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf (buf, fmt, args); /* buf is now the msg */ data/xwatch-2.11/src/addfile.c:35: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 data/xwatch-2.11/src/addfile.c:78: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). if (! (f = fopen (fname, "r")) ) /* is it a textfile */ data/xwatch-2.11/src/addline.c:33: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 data/xwatch-2.11/src/addline.c:99: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 (outbuf, "@C%d ", colindex); data/xwatch-2.11/src/addline.c:125:21: [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 (outbuf, "@C%d ", colindex); data/xwatch-2.11/src/colorname2rgb.c:36: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 data/xwatch-2.11/src/colorname2rgb.c:56:17: [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). if (! (fp = fopen(RGB_FILE, "r")) ) /* open database file */ data/xwatch-2.11/src/parsecolorstring.c:33: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 data/xwatch-2.11/src/parsegag.c:33: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 data/xwatch-2.11/src/scanfile.c:37: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 data/xwatch-2.11/src/scanfile.c:88: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). if (! (f = fopen (finfo [i].name, "r")) ) data/xwatch-2.11/src/scanfile.c:102: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 (buf, "%2.2d:%2.2d'%2.2d ", data/xwatch-2.11/src/scanfile.c:108:2: [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 (buf, ": "); data/xwatch-2.11/src/warning.c:33: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 data/xwatch-2.11/src/addline.c:101:3: [1] (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 character. strcpy (outbuf, " "); data/xwatch-2.11/src/addline.c:107: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). strlen (outbuf)); data/xwatch-2.11/src/addline.c:109: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). strlen (cp)); data/xwatch-2.11/src/addline.c:127:21: [1] (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 character. strcpy (outbuf, " "); data/xwatch-2.11/src/addline.c:128:17: [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 (outbuf, " "); data/xwatch-2.11/src/addline.c:129: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). len_of_color_code = strlen(outbuf); data/xwatch-2.11/src/addline.c:131: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_to_print = strlen(outbuf); data/xwatch-2.11/src/addline.c:156:13: [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 (outbuf, " "); data/xwatch-2.11/src/parsecolorstring.c:50:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (str, cp, 255); data/xwatch-2.11/src/parsecolorstring.c:53: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). cp = str + strlen (str) - 1; data/xwatch-2.11/src/parsegag.c:44:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (str, cp, 255); data/xwatch-2.11/src/parsegag.c:47: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). cp = str + strlen (str) - 1; data/xwatch-2.11/src/scanfile.c:119: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). bufpos = strlen (buf); data/xwatch-2.11/src/xwatch.c:69: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). totlength += strlen (argv [i]) + 1; ANALYSIS SUMMARY: Hits = 39 Lines analyzed = 1841 in approximately 0.09 seconds (21099 lines/second) Physical Source Lines of Code (SLOC) = 864 Hits@level = [0] 11 [1] 14 [2] 14 [3] 0 [4] 11 [5] 0 Hits@level+ = [0+] 50 [1+] 39 [2+] 25 [3+] 11 [4+] 11 [5+] 0 Hits/KSLOC@level+ = [0+] 57.8704 [1+] 45.1389 [2+] 28.9352 [3+] 12.7315 [4+] 12.7315 [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.