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/linux-ftpd-0.17/ftpd/pathnames.h Examining data/linux-ftpd-0.17/ftpd/logwtmp.c Examining data/linux-ftpd-0.17/ftpd/extern.h Examining data/linux-ftpd-0.17/ftpd/logutmp.c Examining data/linux-ftpd-0.17/ftpd/popen.c Examining data/linux-ftpd-0.17/ftpd/ftpd.c Examining data/linux-ftpd-0.17/version.h Examining data/linux-ftpd-0.17/support/daemon.c Examining data/linux-ftpd-0.17/support/daemon.h Examining data/linux-ftpd-0.17/support/isexpired.c Examining data/linux-ftpd-0.17/support/isexpired.h Examining data/linux-ftpd-0.17/support/setproctitle.h Examining data/linux-ftpd-0.17/support/vis.h Examining data/linux-ftpd-0.17/support/setproctitle.c Examining data/linux-ftpd-0.17/support/vis.c FINAL RESULTS: data/linux-ftpd-0.17/ftpd/ftpd.c:304:2: [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, format, ap); data/linux-ftpd-0.17/ftpd/ftpd.c:401: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(tbuf, pkg); data/linux-ftpd-0.17/ftpd/ftpd.c:402: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(version, versionpre); data/linux-ftpd-0.17/ftpd/ftpd.c:407:8: [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(version, tmp); data/linux-ftpd-0.17/ftpd/ftpd.c:754:9: [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(new, s); data/linux-ftpd-0.17/ftpd/ftpd.c:1149:13: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. strcmp(crypt(passwd, pw->pw_passwd), pw->pw_passwd)) data/linux-ftpd-0.17/ftpd/ftpd.c:1285:4: [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(rootdir, pw->pw_dir); data/linux-ftpd-0.17/ftpd/ftpd.c:1395:10: [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. (void) snprintf(line, sizeof(line), cmd, name); data/linux-ftpd-0.17/ftpd/ftpd.c:2077:8: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)vprintf(fmt, ap); data/linux-ftpd-0.17/ftpd/ftpd.c:2110:8: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)vprintf(fmt, ap); data/linux-ftpd-0.17/ftpd/popen.c:193:3: [4] (shell) execv: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execv(gargv[0], gargv); data/linux-ftpd-0.17/support/setproctitle.c:123:9: [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(p, Argv0); data/linux-ftpd-0.17/support/setproctitle.c:129:9: [4] (format) vsnprintf: 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. (void) vsnprintf(p, sizeof(buf) - (p - buf), fmt, ap); data/linux-ftpd-0.17/support/setproctitle.c:139:9: [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(Argv[0], buf); data/linux-ftpd-0.17/ftpd/ftpd.c:392:2: [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(time(NULL)^(getpid()<<8)); data/linux-ftpd-0.17/ftpd/ftpd.c:417:15: [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, argstr)) != -1) { data/linux-ftpd-0.17/ftpd/ftpd.c:1132:8: [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. us = random() % 3000000; data/linux-ftpd-0.17/ftpd/ftpd.c:1293:7: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(rootdir) < 0 || chdir("/") < 0) { data/linux-ftpd-0.17/ftpd/ftpd.c:1300:7: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(rootdir) < 0 || chdir("/") < 0) { data/linux-ftpd-0.17/ftpd/ftpd.c:2756:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(path, rpath) == NULL) { data/linux-ftpd-0.17/ftpd/ftpd.c:156: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. static char version[sizeof(versionpre)+sizeof(pkg)]; data/linux-ftpd-0.17/ftpd/ftpd.c:208:1: [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 tmpline[7]; data/linux-ftpd-0.17/ftpd/ftpd.c:209:1: [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 hostname[MAXHOSTNAMELEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:210:1: [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 remotehost[MAXHOSTNAMELEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:211:1: [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 dhostname[MAXHOSTNAMELEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:213: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. static char ttyline[20]; data/linux-ftpd-0.17/ftpd/ftpd.c:242:1: [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 proctitle[BUFSIZ]; /* initial part of title */ data/linux-ftpd-0.17/ftpd/ftpd.c:313:9: [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 path[MAXPATHLEN+1]; /* path + '/' */ data/linux-ftpd-0.17/ftpd/ftpd.c:385:2: [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 *cp, line[LINE_MAX]; data/linux-ftpd-0.17/ftpd/ftpd.c:400: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 *tmp, *tmp2, tbuf[sizeof(pkg)+1]; data/linux-ftpd-0.17/ftpd/ftpd.c:456:14: [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). timeout = atoi(optarg); data/linux-ftpd-0.17/ftpd/ftpd.c:462:17: [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). maxtimeout = atoi(optarg); data/linux-ftpd-0.17/ftpd/ftpd.c:675: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 ((fd = fopen(_PATH_NOLOGIN,"r")) != NULL) { data/linux-ftpd-0.17/ftpd/ftpd.c:686: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 ((fd = fopen(_PATH_FTPWELCOME, "r")) != NULL) { data/linux-ftpd-0.17/ftpd/ftpd.c:794: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. static char curname[16]; /* current USER name */ data/linux-ftpd-0.17/ftpd/ftpd.c:902:2: [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 *p, line[BUFSIZ]; data/linux-ftpd-0.17/ftpd/ftpd.c:904: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 ((fd = fopen(fname, "r")) != NULL) { data/linux-ftpd-0.17/ftpd/ftpd.c:1160:9: [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 homedir[MAXPATHLEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:1161:2: [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 rootdir[MAXPATHLEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:1251: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(&utmp.ut_addr, data/linux-ftpd-0.17/ftpd/ftpd.c:1256: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(&utmp.ut_addr, data/linux-ftpd-0.17/ftpd/ftpd.c:1267:17: [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 ((statfd = open(_PATH_FTPDSTATFILE, O_WRONLY|O_APPEND)) < 0) data/linux-ftpd-0.17/ftpd/ftpd.c:1335: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 ((fd = fopen(_PATH_FTPLOGINMESG, "r")) != NULL) { data/linux-ftpd-0.17/ftpd/ftpd.c:1336: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 *cp, line[LINE_MAX]; data/linux-ftpd-0.17/ftpd/ftpd.c:1390:9: [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). fin = fopen(name, "r"), closefunc = fclose; data/linux-ftpd-0.17/ftpd/ftpd.c:1393: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[BUFSIZ]; data/linux-ftpd-0.17/ftpd/ftpd.c:1473: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). fout = fopen(name, mode); data/linux-ftpd-0.17/ftpd/ftpd.c:1614:2: [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 sizebuf[32]; data/linux-ftpd-0.17/ftpd/ftpd.c:1690: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 ipaddr[INET6_ADDRSTRLEN], port[12]; data/linux-ftpd-0.17/ftpd/ftpd.c:1879:2: [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/linux-ftpd-0.17/ftpd/ftpd.c:1964:2: [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[LINE_MAX]; data/linux-ftpd-0.17/ftpd/ftpd.c:1993:2: [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 ipaddr[INET6_ADDRSTRLEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:2181: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 ((message = fopen(_PATH_CWDMESG, "r")) != NULL) { data/linux-ftpd-0.17/ftpd/ftpd.c:2182: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 *cp, line[LINE_MAX]; data/linux-ftpd-0.17/ftpd/ftpd.c:2199:2: [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 npath[MAXPATHLEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:2237:2: [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 path[MAXPATHLEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:2269:2: [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 host[NI_MAXHOST]; data/linux-ftpd-0.17/ftpd/ftpd.c:2457:2: [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 delim, ipaddr[INET6_ADDRSTRLEN], portstr[12]; data/linux-ftpd-0.17/ftpd/ftpd.c:2505: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(portstr, "%d", port); data/linux-ftpd-0.17/ftpd/ftpd.c:2515:2: [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(&data_dest, aiptr->ai_addr, aiptr->ai_addrlen); data/linux-ftpd-0.17/ftpd/ftpd.c:2537:9: [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 new[MAXPATHLEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:2560:8: [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). fd = open(new, O_RDWR|O_CREAT|O_EXCL, 0666); data/linux-ftpd-0.17/ftpd/ftpd.c:2667: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 nbuf[MAXPATHLEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:2742:2: [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[400 + MAXHOSTNAMELEN*4 + MAXPATHLEN*4]; data/linux-ftpd-0.17/ftpd/ftpd.c:2743:2: [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 dir[MAXPATHLEN], path[MAXPATHLEN], rpath[MAXPATHLEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:2744:2: [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 vremotehost[MAXHOSTNAMELEN*4], vpath[MAXPATHLEN*4]; data/linux-ftpd-0.17/ftpd/ftpd.c:2782:2: [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 ipaddr[INET6_ADDRSTRLEN]; data/linux-ftpd-0.17/ftpd/ftpd.c:2783:2: [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 host[NI_MAXHOST]; data/linux-ftpd-0.17/ftpd/logutmp.c:83: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). && (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) < 0)) data/linux-ftpd-0.17/ftpd/logwtmp.c:69:22: [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 < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0) data/linux-ftpd-0.17/ftpd/logwtmp.c:95:8: [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(&ut.ut_addr, data/linux-ftpd-0.17/ftpd/logwtmp.c:100:8: [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(&ut.ut_addr, data/linux-ftpd-0.17/ftpd/popen.c:80:2: [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 **pop, *argv[MAX_ARGV], *gargv[MAX_GARGV]; data/linux-ftpd-0.17/support/daemon.c:64:7: [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). fd = open(_PATH_DEVNULL, O_RDWR, 0); data/linux-ftpd-0.17/support/setproctitle.c:74: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. static char Argv0[128]; /* program name */ data/linux-ftpd-0.17/support/setproctitle.c:116:9: [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[2048]; data/linux-ftpd-0.17/support/setproctitle.c:124:9: [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. (void) strcat(p, ": "); data/linux-ftpd-0.17/ftpd/ftpd.c:318:3: [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(path, "/"); data/linux-ftpd-0.17/ftpd/ftpd.c:705:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(hostname, aiptr->ai_canonname, sizeof(hostname)); data/linux-ftpd-0.17/ftpd/ftpd.c:747: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). char *new = malloc((unsigned) strlen(s) + 1); data/linux-ftpd-0.17/ftpd/ftpd.c:777: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). memset(save.pw_passwd, 0, strlen(save.pw_passwd)); data/linux-ftpd-0.17/ftpd/ftpd.c:882:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(curname, name, sizeof(curname)-1); data/linux-ftpd-0.17/ftpd/ftpd.c:1011: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). sp = PAM_message + strlen(PAM_message); data/linux-ftpd-0.17/ftpd/ftpd.c:1134:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(us); data/linux-ftpd-0.17/ftpd/ftpd.c:1246:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(utmp.ut_name, pw->pw_name, sizeof(utmp.ut_name)); data/linux-ftpd-0.17/ftpd/ftpd.c:1247:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(utmp.ut_host, remotehost, sizeof(utmp.ut_host)); data/linux-ftpd-0.17/ftpd/ftpd.c:1248:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(utmp.ut_line, ttyline, sizeof(utmp.ut_line)); data/linux-ftpd-0.17/ftpd/ftpd.c:1297: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(pw->pw_dir, "/"); data/linux-ftpd-0.17/ftpd/ftpd.c:1304: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(pw->pw_dir, "/"); data/linux-ftpd-0.17/ftpd/ftpd.c:1375:9: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(defumask); data/linux-ftpd-0.17/ftpd/ftpd.c:1423:12: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c=getc(fin)) == EOF) { data/linux-ftpd-0.17/ftpd/ftpd.c:1490:12: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c=getc(fout)) == EOF) { data/linux-ftpd-0.17/ftpd/ftpd.c:1766:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(instr)) != EOF) { data/linux-ftpd-0.17/ftpd/ftpd.c:1834:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((cnt = read(filefd, buf, size)) > 0 && data/linux-ftpd-0.17/ftpd/ftpd.c:1894:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). cnt = read(fileno(instr), buf, sizeof(buf)); data/linux-ftpd-0.17/ftpd/ftpd.c:1914:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(instr)) != EOF) { data/linux-ftpd-0.17/ftpd/ftpd.c:1921:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c = getc(instr)) != '\n') { data/linux-ftpd-0.17/ftpd/ftpd.c:1969:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(fin)) != EOF) { data/linux-ftpd-0.17/ftpd/ftpd.c:2275:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(remotehost, host, sizeof(remotehost)-1); data/linux-ftpd-0.17/ftpd/ftpd.c:2463: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 ( ! trans || strlen(trans) < 10 ) data/linux-ftpd-0.17/ftpd/ftpd.c:2551:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(new, local, sizeof(new)-1); data/linux-ftpd-0.17/ftpd/ftpd.c:2553: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). len = strlen(new); data/linux-ftpd-0.17/ftpd/ftpd.c:2658: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). byte_count += strlen(dirname) + 1; data/linux-ftpd-0.17/ftpd/ftpd.c:2704: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). byte_count += strlen(nbuf) + 1; data/linux-ftpd-0.17/ftpd/ftpd.c:2751: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). vpw = (char *)malloc(strlen((guest) ? guestpw : pw->pw_name)*4+1); data/linux-ftpd-0.17/ftpd/ftpd.c:2757:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(rpath, path, sizeof rpath-1); data/linux-ftpd-0.17/ftpd/ftpd.c:2774:22: [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). write(statfd, buf, strlen(buf)); data/linux-ftpd-0.17/ftpd/logutmp.c:92:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &ubuf, sizeof(UTMP)) == sizeof(UTMP)) { data/linux-ftpd-0.17/ftpd/logutmp.c:123:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(fd, &ut, sizeof(UTMP)) == sizeof(UTMP)) { data/linux-ftpd-0.17/ftpd/logwtmp.c:89:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(ut.ut_line, line, sizeof(ut.ut_line)); data/linux-ftpd-0.17/ftpd/logwtmp.c:90:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(ut.ut_name, name, sizeof(ut.ut_name)); data/linux-ftpd-0.17/ftpd/logwtmp.c:91:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(ut.ut_host, host, sizeof(ut.ut_host)); data/linux-ftpd-0.17/support/setproctitle.c:100: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). LastArgv = envp[i - 1] + strlen(envp[i - 1]); data/linux-ftpd-0.17/support/setproctitle.c:102: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). LastArgv = argv[argc - 1] + strlen(argv[argc - 1]); data/linux-ftpd-0.17/support/setproctitle.c:107:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Argv0, tmp, sizeof(Argv0)); data/linux-ftpd-0.17/support/setproctitle.c:125: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). p += strlen(p); data/linux-ftpd-0.17/support/setproctitle.c:132: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). i = strlen(buf); ANALYSIS SUMMARY: Hits = 117 Lines analyzed = 3962 in approximately 0.19 seconds (21230 lines/second) Physical Source Lines of Code (SLOC) = 2831 Hits@level = [0] 82 [1] 40 [2] 57 [3] 6 [4] 14 [5] 0 Hits@level+ = [0+] 199 [1+] 117 [2+] 77 [3+] 20 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 70.2932 [1+] 41.3282 [2+] 27.1989 [3+] 7.06464 [4+] 4.94525 [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.