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/glosstex-0.4.dfsg.1/config.h Examining data/glosstex-0.4.dfsg.1/database.c Examining data/glosstex-0.4.dfsg.1/database.h Examining data/glosstex-0.4.dfsg.1/error.h Examining data/glosstex-0.4.dfsg.1/glosstex.h Examining data/glosstex-0.4.dfsg.1/labels.c Examining data/glosstex-0.4.dfsg.1/labels.h Examining data/glosstex-0.4.dfsg.1/list.c Examining data/glosstex-0.4.dfsg.1/list.h Examining data/glosstex-0.4.dfsg.1/main.c Examining data/glosstex-0.4.dfsg.1/version.c Examining data/glosstex-0.4.dfsg.1/version.h Examining data/glosstex-0.4.dfsg.1/error.c FINAL RESULTS: data/glosstex-0.4.dfsg.1/database.c:105:2: [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 (line, buf); data/glosstex-0.4.dfsg.1/database.c:116:2: [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 (&line[len], buf); data/glosstex-0.4.dfsg.1/database.c:310:12: [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 (item, label); /* FIXME: lint code error */ data/glosstex-0.4.dfsg.1/error.c:44:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf, "\n%s: ", progname); data/glosstex-0.4.dfsg.1/error.c:45:10: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. (void) vsprintf (buf + strlen (buf), fmt, ap); data/glosstex-0.4.dfsg.1/error.c:48:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf + strlen (buf), ": %s\n", strerror (errno_save)); data/glosstex-0.4.dfsg.1/error.c:50:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf + strlen (buf), ": %s\n", sys_errlist[errno_save]); data/glosstex-0.4.dfsg.1/error.c:73:12: [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. (void) vfprintf (stdout, fmt, ap); data/glosstex-0.4.dfsg.1/error.c:76:12: [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. (void) vfprintf (logfile, fmt, ap); data/glosstex-0.4.dfsg.1/main.c:79: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 (progname, argv[0]); data/glosstex-0.4.dfsg.1/main.c:124:5: [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. fprintf (stderr, usage, progname); data/glosstex-0.4.dfsg.1/main.c:178: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 (new, string); data/glosstex-0.4.dfsg.1/main.c:179: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 (new, ext); data/glosstex-0.4.dfsg.1/main.c:183: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 (new, string); data/glosstex-0.4.dfsg.1/main.c:202:3: [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 (filename, ext); data/glosstex-0.4.dfsg.1/database.c:62:21: [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 ((dbfile = fopen (filename->ptr, "r")) == NULL) { data/glosstex-0.4.dfsg.1/database.c:83: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 buf[LINESIZE]; data/glosstex-0.4.dfsg.1/database.c:133: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 label[LINESIZE]; data/glosstex-0.4.dfsg.1/database.c:134: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 item[LINESIZE]; data/glosstex-0.4.dfsg.1/database.c:135: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 longform[LINESIZE]; data/glosstex-0.4.dfsg.1/error.c:38: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 buf[BUFSIZE]; data/glosstex-0.4.dfsg.1/labels.c:47: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 buf[LINESIZE]; data/glosstex-0.4.dfsg.1/labels.c:55: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 ((infile = fopen (inname, "r")) == NULL) { data/glosstex-0.4.dfsg.1/main.c:76:15: [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. progname = (char *) malloc (strlen (argv[0]) + 1); data/glosstex-0.4.dfsg.1/main.c:156:18: [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 ((outfile = fopen (outname, "w")) == NULL) { data/glosstex-0.4.dfsg.1/main.c:164:18: [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 ((logfile = fopen (logname, "w")) == NULL) { data/glosstex-0.4.dfsg.1/database.c:88: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). if (buf[strlen (buf) - 1] == '\n') data/glosstex-0.4.dfsg.1/database.c:103: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). line = (char *) malloc (strlen (buf) + 1); data/glosstex-0.4.dfsg.1/database.c:107:11: [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 (line[strlen (line) - 1] == '\n') data/glosstex-0.4.dfsg.1/database.c:108: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). line[strlen (line) - 1] = ' '; data/glosstex-0.4.dfsg.1/database.c:113: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). size_t len = strlen (line); /* LINT: null is ok here */ data/glosstex-0.4.dfsg.1/database.c:114: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). line = (char *) realloc (line, len + strlen (buf) + 1); data/glosstex-0.4.dfsg.1/database.c:117:11: [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 (line[strlen (line) - 1] == '\n') data/glosstex-0.4.dfsg.1/database.c:118: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). line[strlen (line) - 1] = ' '; data/glosstex-0.4.dfsg.1/database.c:156:11: [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). index = strlen (&line[ptr]); data/glosstex-0.4.dfsg.1/error.c:45: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). (void) vsprintf (buf + strlen (buf), fmt, ap); data/glosstex-0.4.dfsg.1/error.c:48:18: [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). sprintf (buf + strlen (buf), ": %s\n", strerror (errno_save)); data/glosstex-0.4.dfsg.1/error.c:50:18: [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). sprintf (buf + strlen (buf), ": %s\n", sys_errlist[errno_save]); data/glosstex-0.4.dfsg.1/labels.c:62: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). if (buf[strlen (buf) - 1] == '\n') data/glosstex-0.4.dfsg.1/main.c:76: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). progname = (char *) malloc (strlen (argv[0]) + 1); data/glosstex-0.4.dfsg.1/main.c:176: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). new = (char *) malloc (strlen (string) + strlen (ext) + 1); data/glosstex-0.4.dfsg.1/main.c:176:46: [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). new = (char *) malloc (strlen (string) + strlen (ext) + 1); data/glosstex-0.4.dfsg.1/main.c:181: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). new = (char *) malloc (strlen (string) + 1); data/glosstex-0.4.dfsg.1/main.c:197: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). filename = (char *) malloc (len + strlen (ext) + 1); data/glosstex-0.4.dfsg.1/main.c:200:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (filename, string, len); ANALYSIS SUMMARY: Hits = 45 Lines analyzed = 1252 in approximately 0.43 seconds (2881 lines/second) Physical Source Lines of Code (SLOC) = 713 Hits@level = [0] 4 [1] 19 [2] 11 [3] 0 [4] 15 [5] 0 Hits@level+ = [0+] 49 [1+] 45 [2+] 26 [3+] 15 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 68.7237 [1+] 63.1136 [2+] 36.4656 [3+] 21.0379 [4+] 21.0379 [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.