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/fortune-mod-1.99.1/fortune/fortune.c Examining data/fortune-mod-1.99.1/util/randstr.c Examining data/fortune-mod-1.99.1/util/strfile.h Examining data/fortune-mod-1.99.1/util/rot.c Examining data/fortune-mod-1.99.1/util/unstr.c Examining data/fortune-mod-1.99.1/util/strfile.c FINAL RESULTS: data/fortune-mod-1.99.1/fortune/fortune.c:174:38: [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 DPRINTF(l,x) if (Debug >= l) fprintf x; data/fortune-mod-1.99.1/fortune/fortune.c:264:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf(buf, "%s version %s", PROGRAM_NAME, PROGRAM_VERSION); data/fortune-mod-1.99.1/fortune/fortune.c:542:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(datfile, R_OK) < 0) data/fortune-mod-1.99.1/fortune/fortune.c:580: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). (void) strcat(strcat(strcpy(path, dir), "/"), file); data/fortune-mod-1.99.1/fortune/fortune.c:580:23: [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) strcat(strcat(strcpy(path, dir), "/"), file); data/fortune-mod-1.99.1/fortune/fortune.c:680:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(testpath, "%s.u8", path); data/fortune-mod-1.99.1/fortune/fortune.c:1693:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(crequest, "UTF-8..%s", ctype); data/fortune-mod-1.99.1/util/randstr.c:125:6: [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(Datafile, Infile); data/fortune-mod-1.99.1/util/randstr.c:130:6: [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(Datafile, Infile); data/fortune-mod-1.99.1/util/strfile.c:213: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). (void) strcpy(Outfile, *argv); data/fortune-mod-1.99.1/util/strfile.c:222: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(Outfile, Infile); data/fortune-mod-1.99.1/util/unstr.c:146:6: [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(Datafile, Infile); data/fortune-mod-1.99.1/util/unstr.c:151:6: [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(Datafile, Infile); data/fortune-mod-1.99.1/util/unstr.c:157:6: [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(Outfile, *av); data/fortune-mod-1.99.1/fortune/fortune.c:627:9: [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. lang=getenv("LC_ALL"); data/fortune-mod-1.99.1/fortune/fortune.c:628:20: [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. if (!lang) lang=getenv("LC_MESSAGES"); data/fortune-mod-1.99.1/fortune/fortune.c:629:20: [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. if (!lang) lang=getenv("LANGUAGE"); data/fortune-mod-1.99.1/fortune/fortune.c:630:20: [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. if (!lang) lang=getenv("LANG"); data/fortune-mod-1.99.1/fortune/fortune.c:817:18: [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. lang=getenv("LC_ALL"); data/fortune-mod-1.99.1/fortune/fortune.c:818:29: [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. if (!lang) lang=getenv("LC_MESSAGES"); data/fortune-mod-1.99.1/fortune/fortune.c:819:29: [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. if (!lang) lang=getenv("LANGUAGE"); data/fortune-mod-1.99.1/fortune/fortune.c:820:22: [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. if (!lang) lang=getenv("LANG"); data/fortune-mod-1.99.1/fortune/fortune.c:938:7: [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. lang=getenv("LC_ALL"); data/fortune-mod-1.99.1/fortune/fortune.c:939:18: [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. if (!lang) lang=getenv("LC_MESSAGES"); data/fortune-mod-1.99.1/fortune/fortune.c:940:18: [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. if (!lang) lang=getenv("LANGUAGE"); data/fortune-mod-1.99.1/fortune/fortune.c:941:18: [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. if (!lang) lang=getenv("LANG"); data/fortune-mod-1.99.1/fortune/fortune.c:985:65: [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. snprintf (locpathname, sizeof (locpathname), "%s/%s", getenv ("PWD"), sp); data/fortune-mod-1.99.1/fortune/fortune.c:1013:18: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((ch = getopt(argc, argv, "acDefilm:n:osuvw")) != EOF) data/fortune-mod-1.99.1/fortune/fortune.c:1015:18: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((ch = getopt(argc, argv, "acefilm:n:osuvw")) != EOF) data/fortune-mod-1.99.1/fortune/fortune.c:1343:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. choice = random() % parent->num_children; data/fortune-mod-1.99.1/fortune/fortune.c:1354:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. choice = random() % parent->tbl.str_numstr; data/fortune-mod-1.99.1/fortune/fortune.c:1393:12: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. fp->pos = random() % fp->tbl.str_numstr; data/fortune-mod-1.99.1/fortune/fortune.c:1413:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. choice = random() % 100; data/fortune-mod-1.99.1/fortune/fortune.c:1436:15: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. choice = random() % Noprob_tbl.str_numstr; data/fortune-mod-1.99.1/fortune/fortune.c:1710:5: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((int) (time((time_t *) NULL) + getpid())); data/fortune-mod-1.99.1/util/randstr.c:151:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. pos = random() % fp->str_numstr; data/fortune-mod-1.99.1/util/randstr.c:164:14: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. choice = random() % fp.str_numstr; data/fortune-mod-1.99.1/util/randstr.c:216:5: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((int) (time((time_t *) NULL) + getpid())); data/fortune-mod-1.99.1/util/strfile.c:177:18: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((ch = getopt(argc, argv, "c:iorsx")) != EOF) data/fortune-mod-1.99.1/util/strfile.c:382:5: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((int) (time((time_t *) NULL) + getpid())); data/fortune-mod-1.99.1/util/strfile.c:396:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. i = random() % cnt; data/fortune-mod-1.99.1/util/unstr.c:122:18: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((ch = getopt(ac, av, "c:")) != EOF) data/fortune-mod-1.99.1/fortune/fortune.c:263:12: [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. static char buf[BUFSIZ]; data/fortune-mod-1.99.1/fortune/fortune.c:541:5: [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(datfile, ".dat"); data/fortune-mod-1.99.1/fortune/fortune.c:597:15: [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). if ((fd = open(path, O_RDONLY)) < 0 || *path != '/') data/fortune-mod-1.99.1/fortune/fortune.c:632:6: [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 llang[512]; data/fortune-mod-1.99.1/fortune/fortune.c:633:6: [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 langdir[512]; data/fortune-mod-1.99.1/fortune/fortune.c:795: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 langdir[512]; data/fortune-mod-1.99.1/fortune/fortune.c:796: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 fullpathname[512],locpathname[512]; data/fortune-mod-1.99.1/fortune/fortune.c:822: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 llang[512]; data/fortune-mod-1.99.1/fortune/fortune.c:840:6: [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 ll[3]; data/fortune-mod-1.99.1/fortune/fortune.c:943:4: [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 llang[512]; data/fortune-mod-1.99.1/fortune/fortune.c:962:8: [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 ll[3]; data/fortune-mod-1.99.1/fortune/fortune.c:1038:15: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). SLEN = atoi(optarg); data/fortune-mod-1.99.1/fortune/fortune.c:1243: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). if ((fd = open(fp->datfile, O_RDONLY)) < 0) data/fortune-mod-1.99.1/fortune/fortune.c:1376:39: [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). if (fp->datfd < 0 && (fp->datfd = open(fp->datfile, O_RDONLY)) < 0) data/fortune-mod-1.99.1/fortune/fortune.c:1615:14: [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. unsigned char line[BUFSIZ]; data/fortune-mod-1.99.1/fortune/fortune.c:1657:14: [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. unsigned char line[BUFSIZ]; data/fortune-mod-1.99.1/util/randstr.c:126:6: [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(Datafile, ".dat"); data/fortune-mod-1.99.1/util/randstr.c:176:14: [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. unsigned char line[BUFSIZ]; data/fortune-mod-1.99.1/util/randstr.c:199: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 ((Inf = fopen(Infile, "r")) == NULL) data/fortune-mod-1.99.1/util/randstr.c:204: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 ((Dataf = fopen(Datafile, "r")) == NULL) data/fortune-mod-1.99.1/util/strfile.c:223: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(Outfile, ".dat"); data/fortune-mod-1.99.1/util/strfile.c:330:14: [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). Sort_1 = fopen(Infile, "r"); data/fortune-mod-1.99.1/util/strfile.c:331:14: [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). Sort_2 = fopen(Infile, "r"); data/fortune-mod-1.99.1/util/strfile.c:349:12: [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. static char buf[3]; data/fortune-mod-1.99.1/util/strfile.c:420:12: [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. static char string[257]; data/fortune-mod-1.99.1/util/strfile.c:423: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 ((inf = fopen(Infile, "r")) == NULL) data/fortune-mod-1.99.1/util/strfile.c:429: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 ((outf = fopen(Outfile, "w")) == NULL) data/fortune-mod-1.99.1/util/unstr.c:147:6: [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(Datafile, ".dat"); data/fortune-mod-1.99.1/util/unstr.c:180: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 buf[BUFSIZ]; data/fortune-mod-1.99.1/util/unstr.c:216: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 ((Inf = fopen(Infile, "r")) == NULL) data/fortune-mod-1.99.1/util/unstr.c:221: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 ((Dataf = fopen(Datafile, "r")) == NULL) data/fortune-mod-1.99.1/util/unstr.c:228:22: [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). else if ((Outf = fopen(Outfile, "w+")) == NULL) data/fortune-mod-1.99.1/fortune/fortune.c:540:42: [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). datfile = copy(file, (unsigned int) (strlen(file) + 4)); /* +4 for ".dat" */ data/fortune-mod-1.99.1/fortune/fortune.c:579:35: [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 = do_malloc((unsigned int) (strlen(dir) + strlen(file) + 2)); data/fortune-mod-1.99.1/fortune/fortune.c:579:49: [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 = do_malloc((unsigned int) (strlen(dir) + strlen(file) + 2)); data/fortune-mod-1.99.1/fortune/fortune.c:580:16: [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. (void) strcat(strcat(strcpy(path, dir), "/"), file); data/fortune-mod-1.99.1/fortune/fortune.c:637:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(llang,lang,sizeof(llang)); data/fortune-mod-1.99.1/fortune/fortune.c:649:38: [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 (strncmp(path,langdir,strlen(FORTDIR)+3) == 0) data/fortune-mod-1.99.1/fortune/fortune.c:671:27: [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). fp->name = do_malloc (strlen (file) + 1); data/fortune-mod-1.99.1/fortune/fortune.c:672:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (fp->name, file, strlen (file) + 1); data/fortune-mod-1.99.1/fortune/fortune.c:672:30: [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). strncpy (fp->name, file, strlen (file) + 1); data/fortune-mod-1.99.1/fortune/fortune.c:674:27: [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). fp->path = do_malloc (strlen (path) + 1); data/fortune-mod-1.99.1/fortune/fortune.c:675:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (fp->path, path, strlen (path) + 1); data/fortune-mod-1.99.1/fortune/fortune.c:675:30: [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). strncpy (fp->path, path, strlen (path) + 1); data/fortune-mod-1.99.1/fortune/fortune.c:679: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). testpath = do_malloc(strlen (path) + 4); data/fortune-mod-1.99.1/fortune/fortune.c:826:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(llang,lang,sizeof(llang)); data/fortune-mod-1.99.1/fortune/fortune.c:842:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ll,lang,2); data/fortune-mod-1.99.1/fortune/fortune.c:946:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(llang,lang,sizeof(llang)); data/fortune-mod-1.99.1/fortune/fortune.c:964:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ll,lang,2); data/fortune-mod-1.99.1/fortune/fortune.c:1248:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &fp->tbl.str_version, sizeof fp->tbl.str_version) != data/fortune-mod-1.99.1/fortune/fortune.c:1255:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &fp->tbl.str_numstr, sizeof fp->tbl.str_numstr) != data/fortune-mod-1.99.1/fortune/fortune.c:1262:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &fp->tbl.str_longlen, sizeof fp->tbl.str_longlen) != data/fortune-mod-1.99.1/fortune/fortune.c:1269:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &fp->tbl.str_shortlen, sizeof fp->tbl.str_shortlen) != data/fortune-mod-1.99.1/fortune/fortune.c:1276:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &fp->tbl.str_flags, sizeof fp->tbl.str_flags) != data/fortune-mod-1.99.1/fortune/fortune.c:1283:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &fp->tbl.stuff, sizeof fp->tbl.stuff) != data/fortune-mod-1.99.1/fortune/fortune.c:1468:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read(fp->datfd, &Seekpts[0], sizeof Seekpts[0]) == -1) data/fortune-mod-1.99.1/fortune/fortune.c:1469:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). || (read(fp->datfd, &Seekpts[1], sizeof Seekpts[1]) == -1)) data/fortune-mod-1.99.1/fortune/fortune.c:1546: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). sp += strlen(sp); data/fortune-mod-1.99.1/fortune/fortune.c:1668: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). nchar += strlen(line); data/fortune-mod-1.99.1/fortune/fortune.c:1692:23: [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). crequest = malloc(strlen(ctype) + 7 + 1); data/fortune-mod-1.99.1/util/rot.c:14:17: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((a = getchar()) != EOF) data/fortune-mod-1.99.1/util/strfile.c:291:26: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (!isalnum(c1 = getc(Sort_1)) && c1 != '\0') data/fortune-mod-1.99.1/util/strfile.c:293:26: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (!isalnum(c2 = getc(Sort_2)) && c2 != '\0') data/fortune-mod-1.99.1/util/strfile.c:309:7: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c1 = getc(Sort_1); data/fortune-mod-1.99.1/util/strfile.c:310:7: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c2 = getc(Sort_2); data/fortune-mod-1.99.1/util/strfile.c:454:38: [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). length = pos - last_off - (sp ? strlen(sp) : 0); ANALYSIS SUMMARY: Hits = 108 Lines analyzed = 2841 in approximately 0.17 seconds (16395 lines/second) Physical Source Lines of Code (SLOC) = 1964 Hits@level = [0] 71 [1] 34 [2] 32 [3] 28 [4] 14 [5] 0 Hits@level+ = [0+] 179 [1+] 108 [2+] 74 [3+] 42 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 91.1405 [1+] 54.9898 [2+] 37.6782 [3+] 21.3849 [4+] 7.12831 [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.