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/gerstensaft-0.3/src/beer.c Examining data/gerstensaft-0.3/src/beer.h Examining data/gerstensaft-0.3/src/gutils.c Examining data/gerstensaft-0.3/src/gutils.h Examining data/gerstensaft-0.3/src/io.c Examining data/gerstensaft-0.3/src/io.h Examining data/gerstensaft-0.3/src/main.c Examining data/gerstensaft-0.3/src/main.h Examining data/gerstensaft-0.3/src/msgbox.c Examining data/gerstensaft-0.3/src/msgbox.h Examining data/gerstensaft-0.3/src/nls.h Examining data/gerstensaft-0.3/src/options.c Examining data/gerstensaft-0.3/src/options.h Examining data/gerstensaft-0.3/src/receive.c Examining data/gerstensaft-0.3/src/receive.h Examining data/gerstensaft-0.3/src/saft.c Examining data/gerstensaft-0.3/src/saft.h Examining data/gerstensaft-0.3/src/send.c Examining data/gerstensaft-0.3/src/send.h FINAL RESULTS: data/gerstensaft-0.3/src/beer.c:83:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (xp, cp); data/gerstensaft-0.3/src/io.c:55:8: [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 (fp->name, entry->d_name); data/gerstensaft-0.3/src/io.c:160:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (fname, "%s/%s", dir, file); data/gerstensaft-0.3/src/io.c:181:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (fname, "%s/%s", dir, file); data/gerstensaft-0.3/src/io.c:202:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (fname, "%s/%s", dir, file); data/gerstensaft-0.3/src/main.c:276: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 (fname, ((struct s_main_data *) data)->dir); data/gerstensaft-0.3/src/main.c:290:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (fname, "/%s", file); data/gerstensaft-0.3/src/main.c:292:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (fname, "%s/%s", ((struct s_main_data *) data)->dir, file); data/gerstensaft-0.3/src/main.c:367:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (fullname, "%s/%s", ((struct s_main_data *) data)->dir, fname); data/gerstensaft-0.3/src/main.c:369:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (fullname, "/%s", fname); data/gerstensaft-0.3/src/main.c:412:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (s, _("From: %s"), sender); data/gerstensaft-0.3/src/receive.c:116:14: [4] (shell) popen: 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. if ((rec = popen ("receive -l 2> /dev/null", "r")) == NULL) data/gerstensaft-0.3/src/receive.c:151:7: [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 (input, line); data/gerstensaft-0.3/src/receive.c:158: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 (input, line); data/gerstensaft-0.3/src/receive.c:170:7: [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 (sender, input+5); data/gerstensaft-0.3/src/receive.c:180:6: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (cp, strlen(input)-6, input+6); data/gerstensaft-0.3/src/receive.c:263:9: [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. ret = system (cmd); data/gerstensaft-0.3/src/saft.c:133:11: [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. ret = system (cmd); data/gerstensaft-0.3/src/send.c:142:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (xp, addr); data/gerstensaft-0.3/src/send.c:431:9: [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. ret = system (cmd); data/gerstensaft-0.3/src/beer.c:70:52: [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 (asprintf (&fname, "%s/.gerstensaft/history", getenv("HOME")) == -1) data/gerstensaft-0.3/src/beer.c:96:51: [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 (asprintf (&fname, "%s/.gerstensaft/config", getenv("HOME")) == -1) data/gerstensaft-0.3/src/beer.c:145:8: [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 (!getenv("HOME")) data/gerstensaft-0.3/src/beer.c:148:44: [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 (asprintf (&fname, "%s/.gerstensaft", getenv("HOME")) == -1) data/gerstensaft-0.3/src/beer.c:155:52: [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 (asprintf (&fname, "%s/.gerstensaft/history", getenv("HOME")) == -1) data/gerstensaft-0.3/src/beer.c:170:51: [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 (asprintf (&fname, "%s/.gerstensaft/config", getenv("HOME")) == -1) data/gerstensaft-0.3/src/beer.c:251:16: [3] (buffer) getopt_long: 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 ( (c = getopt_long(argc, argv, "hmrsv", long_options, &longindex)) != -1 ) { data/gerstensaft-0.3/src/beer.c:59: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[300]; data/gerstensaft-0.3/src/beer.c:73:12: [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")) != NULL) { data/gerstensaft-0.3/src/beer.c:99:12: [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")) != NULL) { data/gerstensaft-0.3/src/beer.c:163:10: [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,"w")) != NULL) { data/gerstensaft-0.3/src/beer.c:173:10: [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,"w")) != NULL) { data/gerstensaft-0.3/src/gutils.c:53: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 asize[10]; data/gerstensaft-0.3/src/gutils.c:55: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 *clp[3] = {dummy, fullname, asize}; data/gerstensaft-0.3/src/io.c:112:7: [2] (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 string. strcpy (fp->name, ".."); data/gerstensaft-0.3/src/io.c:233: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 newdir[NAME_MAX]; data/gerstensaft-0.3/src/main.c:158: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 fname[1024]; data/gerstensaft-0.3/src/main.c:170: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 *name, size[10]; data/gerstensaft-0.3/src/main.c:195:6: [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 (name, fp->name, strlen(fp->name)+1); data/gerstensaft-0.3/src/main.c:569: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 *titles[3] = {"", _("Filename"), _("Size")}; data/gerstensaft-0.3/src/main.c:570: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 *rtitles[7] = {"", _("Filename"), _("Date"), _("Size"), "", "", ""}; data/gerstensaft-0.3/src/main.c:571: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 cwd[255]; data/gerstensaft-0.3/src/msgbox.c:41: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[1024]; data/gerstensaft-0.3/src/msgbox.c:113: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[1024]; data/gerstensaft-0.3/src/receive.c:106: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 line[100]; data/gerstensaft-0.3/src/saft.c:63: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 errmsg[1024]; data/gerstensaft-0.3/src/saft.c:67: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 protocol[4]; data/gerstensaft-0.3/src/saft.c:79:5: [2] (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 string. strcpy (protocol, " -4"); data/gerstensaft-0.3/src/saft.c:81:5: [2] (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 string. strcpy (protocol, " -6"); data/gerstensaft-0.3/src/send.c:204: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 *titles[3] = {"", _("Filename"), _("Size")}; data/gerstensaft-0.3/src/send.c:206: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 *name, asize[10]; data/gerstensaft-0.3/src/send.c:305:5: [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 (cp, name, strlen(name)+1); data/gerstensaft-0.3/src/send.c:319:5: [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 (cp, asize, strlen(asize)+1); data/gerstensaft-0.3/src/send.c:401: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 protocol[4]; data/gerstensaft-0.3/src/send.c:415:5: [2] (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 string. strcpy (protocol, " -4"); data/gerstensaft-0.3/src/send.c:417:5: [2] (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 string. strcpy (protocol, " -6"); data/gerstensaft-0.3/src/beer.c:76: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). remainder = !(buf[strlen(buf)-1] == '\n'); data/gerstensaft-0.3/src/beer.c:78:6: [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). buf[strlen(buf)-1] = '\0'; data/gerstensaft-0.3/src/beer.c:80: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 (strlen(buf) && !strncasecmp(buf, "Recipient", 9) && isspace(buf[9])) { data/gerstensaft-0.3/src/beer.c:82: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). xp = (char *)malloc (strlen(cp)+1); data/gerstensaft-0.3/src/beer.c:88:60: [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 (cp = fgets(buf, sizeof(buf)-1, f); cp != NULL && buf[strlen(buf)-1] != '\n'; data/gerstensaft-0.3/src/beer.c:102: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). remainder = !(buf[strlen(buf)-1] == '\n'); data/gerstensaft-0.3/src/beer.c:104:6: [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). buf[strlen(buf)-1] = '\0'; data/gerstensaft-0.3/src/beer.c:106: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 (strlen(buf)) { data/gerstensaft-0.3/src/beer.c:130:60: [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 (cp = fgets(buf, sizeof(buf)-1, f); cp != NULL && buf[strlen(buf)-1] != '\n'; data/gerstensaft-0.3/src/io.c:41: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). if ((fname = (char *)malloc(strlen(dir)+256)) == NULL) data/gerstensaft-0.3/src/io.c:54: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). if ((fp->name = (char *)malloc(strlen(entry->d_name)+1)) != NULL) data/gerstensaft-0.3/src/io.c:56: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). snprintf (fname, strlen(dir)+256, "%s/%s", dir, entry->d_name); data/gerstensaft-0.3/src/io.c:136: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). if (!dir || !strlen(dir)) data/gerstensaft-0.3/src/io.c:140: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). for (i=strlen(dir)-1; i>0 && dir[i]=='/'; i--); data/gerstensaft-0.3/src/io.c:144:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (cp, dir, i+1); data/gerstensaft-0.3/src/io.c:158: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). if ((fname = (char *)malloc (strlen (dir) + strlen (file) +2)) == NULL) data/gerstensaft-0.3/src/io.c:158: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). if ((fname = (char *)malloc (strlen (dir) + strlen (file) +2)) == NULL) data/gerstensaft-0.3/src/io.c:179:34: [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 ((fname = (char *)malloc (strlen (dir) + strlen (file) +2)) == NULL) data/gerstensaft-0.3/src/io.c:179: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). if ((fname = (char *)malloc (strlen (dir) + strlen (file) +2)) == NULL) data/gerstensaft-0.3/src/io.c:200:34: [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 ((fname = (char *)malloc (strlen (dir) + strlen (file) +2)) == NULL) data/gerstensaft-0.3/src/io.c:200: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). if ((fname = (char *)malloc (strlen (dir) + strlen (file) +2)) == NULL) data/gerstensaft-0.3/src/io.c:235: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). if (dirname == NULL || !strlen (dirname) || !(d = opendir ((dirname)))) data/gerstensaft-0.3/src/io.c:278: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). if ((stext = (char *)malloc(strlen(text) + count*3 + 1)) == NULL) data/gerstensaft-0.3/src/io.c:281:21: [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). memset (stext, 0, strlen(text) + count*3 + 1); data/gerstensaft-0.3/src/main.c:119: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(gtk_entry_get_text (GTK_ENTRY(widget))) > 0) { data/gerstensaft-0.3/src/main.c:144:5: [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(gtk_entry_get_text (GTK_ENTRY(GTK_COMBO(((struct s_main_data *) data)->addrinput)->entry))) > 0) { data/gerstensaft-0.3/src/main.c:193: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 ((name = (char *)malloc(strlen(fp->name)+1)) == NULL) data/gerstensaft-0.3/src/main.c:195: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). memcpy (name, fp->name, strlen(fp->name)+1); data/gerstensaft-0.3/src/main.c:274: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). if ((fname = (char *)malloc (strlen (((struct s_main_data *) data)->dir) +1)) == NULL) data/gerstensaft-0.3/src/main.c:287: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). if ((fname = (char *)malloc (strlen (((struct s_main_data *) data)->dir) + strlen (file) +2)) == NULL) data/gerstensaft-0.3/src/main.c:287:77: [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 ((fname = (char *)malloc (strlen (((struct s_main_data *) data)->dir) + strlen (file) +2)) == NULL) data/gerstensaft-0.3/src/main.c:289:6: [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 (((struct s_main_data *) data)->dir) == 1) data/gerstensaft-0.3/src/main.c:363: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). if ((fullname = (char *)malloc (strlen(fname) + strlen(((struct s_main_data *) data)->dir) + 2)) == NULL) data/gerstensaft-0.3/src/main.c:363:53: [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 ((fullname = (char *)malloc (strlen(fname) + strlen(((struct s_main_data *) data)->dir) + 2)) == NULL) data/gerstensaft-0.3/src/main.c:366: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 (((struct s_main_data *) data)->dir) > 1) data/gerstensaft-0.3/src/main.c:409: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). if ((s = (char *)malloc(strlen(sender) + strlen(_("From: %s")))) == NULL) data/gerstensaft-0.3/src/main.c:409: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). if ((s = (char *)malloc(strlen(sender) + strlen(_("From: %s")))) == NULL) data/gerstensaft-0.3/src/msgbox.c:174: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). if (!title || !strlen(title) || !text || !strlen(text)) data/gerstensaft-0.3/src/msgbox.c:174: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). if (!title || !strlen(title) || !text || !strlen(text)) data/gerstensaft-0.3/src/msgbox.c:220: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). if (!title || !strlen(title) || !text || !strlen(text)) data/gerstensaft-0.3/src/msgbox.c:220: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). if (!title || !strlen(title) || !text || !strlen(text)) data/gerstensaft-0.3/src/receive.c:63:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (rf->nr, cp, xp-cp); data/gerstensaft-0.3/src/receive.c:70:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (rf->date, cp, 19); data/gerstensaft-0.3/src/receive.c:79:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (rf->size, cp, xp-cp); data/gerstensaft-0.3/src/receive.c:88: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). if ((rf->flags = (char *)malloc(strlen(xp))) == NULL) data/gerstensaft-0.3/src/receive.c:90: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). memset (rf->flags, 0, strlen(xp)); data/gerstensaft-0.3/src/receive.c:91:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (rf->flags, xp, strlen(xp)-1); data/gerstensaft-0.3/src/receive.c:91:29: [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 (rf->flags, xp, strlen(xp)-1); data/gerstensaft-0.3/src/receive.c:95:34: [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 ((rf->name = (char *)malloc(strlen(cp)+1)) == NULL) data/gerstensaft-0.3/src/receive.c:97:24: [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). memset (rf->name, 0, strlen(cp)+1); data/gerstensaft-0.3/src/receive.c:98:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (rf->name, cp, strlen(cp)); data/gerstensaft-0.3/src/receive.c:98: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). strncpy (rf->name, cp, strlen(cp)); data/gerstensaft-0.3/src/receive.c:134:19: [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 (line[strlen(line)-1] != '\n' && (cp = fgets(line, sizeof(line), rec))); data/gerstensaft-0.3/src/receive.c:142: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). if (line[strlen(line)-1] == '\n') { data/gerstensaft-0.3/src/receive.c:143: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). line[strlen(line)-1] = '\0'; data/gerstensaft-0.3/src/receive.c:146: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). if ((input = (char *)malloc(strlen(line)+1)) == NULL) { data/gerstensaft-0.3/src/receive.c:150: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). memset (input, 0, strlen(line)+1); data/gerstensaft-0.3/src/receive.c:152:19: [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 (line[strlen(line)-1] != '\n' && (cp = fgets(line, sizeof(line), rec))) { data/gerstensaft-0.3/src/receive.c:153: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). if ((input = (char *)realloc(input, strlen(cp)+strlen(line)+1)) == NULL) { data/gerstensaft-0.3/src/receive.c:153: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). if ((input = (char *)realloc(input, strlen(cp)+strlen(line)+1)) == NULL) { data/gerstensaft-0.3/src/receive.c:160: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). input[strlen(input)-1] = '\0'; data/gerstensaft-0.3/src/receive.c:164:36: [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 ((sender = (char *)malloc(strlen(input)-5+1)) == NULL) { data/gerstensaft-0.3/src/receive.c:166:6: [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(input) >= sizeof(line)) data/gerstensaft-0.3/src/receive.c:175: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). if (input[strlen(input)-1] == '"') { data/gerstensaft-0.3/src/receive.c:179:29: [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 ((cp = (char *)malloc(strlen(input)-6)) != NULL) { data/gerstensaft-0.3/src/receive.c:180: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). snprintf (cp, strlen(input)-6, input+6); data/gerstensaft-0.3/src/receive.c:188:8: [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(input) >= sizeof(line)) data/gerstensaft-0.3/src/receive.c:195:8: [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(input) >= sizeof(line)) data/gerstensaft-0.3/src/receive.c:198:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(cp, jewels->date, 10); data/gerstensaft-0.3/src/receive.c:222: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(input) >= sizeof(line)) data/gerstensaft-0.3/src/saft.c:46: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). if ((res = (char *)malloc((strlen(fname)*2)+1)) != NULL) { data/gerstensaft-0.3/src/saft.c:70: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). if (!addr || !strlen(addr)) data/gerstensaft-0.3/src/saft.c:73: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). if (comment && strlen(comment)) data/gerstensaft-0.3/src/send.c:65: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(gtk_entry_get_text (GTK_ENTRY(widget))) > 0) { data/gerstensaft-0.3/src/send.c:85: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(gtk_entry_get_text (GTK_ENTRY(((struct s_send_data *) data)->addrinput->entry))) > 0) data/gerstensaft-0.3/src/send.c:141: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). if (!n && (xp = (char *)malloc (strlen(addr)+1)) != NULL) { data/gerstensaft-0.3/src/send.c:303: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). if ((cp = (char *)malloc (strlen(name)+1)) == NULL) data/gerstensaft-0.3/src/send.c:305: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). memcpy (cp, name, strlen(name)+1); data/gerstensaft-0.3/src/send.c:317: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). if ((cp = (char *)malloc (strlen(asize)+1)) == NULL) data/gerstensaft-0.3/src/send.c:319:24: [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). memcpy (cp, asize, strlen(asize)+1); data/gerstensaft-0.3/src/send.c:467: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(text) > SENDMSG_MAXLEN) data/gerstensaft-0.3/src/send.c:473: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(sp) > SENDMSG_MAXLEN) { data/gerstensaft-0.3/src/send.c:488: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). sp += (strlen(sp)); ANALYSIS SUMMARY: Hits = 139 Lines analyzed = 3514 in approximately 0.14 seconds (24752 lines/second) Physical Source Lines of Code (SLOC) = 2471 Hits@level = [0] 47 [1] 83 [2] 29 [3] 7 [4] 20 [5] 0 Hits@level+ = [0+] 186 [1+] 139 [2+] 56 [3+] 27 [4+] 20 [5+] 0 Hits/KSLOC@level+ = [0+] 75.2732 [1+] 56.2525 [2+] 22.6629 [3+] 10.9268 [4+] 8.09389 [5+] 0 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.