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/lpr-2008.05.17.3/common_source/common.c Examining data/lpr-2008.05.17.3/common_source/common_vars.c Examining data/lpr-2008.05.17.3/common_source/displayq.c Examining data/lpr-2008.05.17.3/common_source/getcap.c Examining data/lpr-2008.05.17.3/common_source/lp.h Examining data/lpr-2008.05.17.3/common_source/lp.local.h Examining data/lpr-2008.05.17.3/common_source/pathnames.h Examining data/lpr-2008.05.17.3/common_source/rmjob.c Examining data/lpr-2008.05.17.3/common_source/startdaemon.c Examining data/lpr-2008.05.17.3/common_source/strlcat.c Examining data/lpr-2008.05.17.3/common_source/strlcpy.c Examining data/lpr-2008.05.17.3/common_source/vis.c Examining data/lpr-2008.05.17.3/common_source/vis.h Examining data/lpr-2008.05.17.3/filters/lpf.c Examining data/lpr-2008.05.17.3/lpc/cmds.c Examining data/lpr-2008.05.17.3/lpc/cmdtab.c Examining data/lpr-2008.05.17.3/lpc/extern.h Examining data/lpr-2008.05.17.3/lpc/lpc.c Examining data/lpr-2008.05.17.3/lpc/lpc.h Examining data/lpr-2008.05.17.3/lpd/extern.h Examining data/lpr-2008.05.17.3/lpd/key.c Examining data/lpr-2008.05.17.3/lpd/lpd.c Examining data/lpr-2008.05.17.3/lpd/lpdchar.c Examining data/lpr-2008.05.17.3/lpd/modes.c Examining data/lpr-2008.05.17.3/lpd/printjob.c Examining data/lpr-2008.05.17.3/lpd/rcmd.c Examining data/lpr-2008.05.17.3/lpd/recvjob.c Examining data/lpr-2008.05.17.3/lpd/ttcompat.c Examining data/lpr-2008.05.17.3/lpq/lpq.c Examining data/lpr-2008.05.17.3/lpr/lpr.c Examining data/lpr-2008.05.17.3/lprm/lprm.c Examining data/lpr-2008.05.17.3/lptest/lptest.c Examining data/lpr-2008.05.17.3/pac/pac.c FINAL RESULTS: data/lpr-2008.05.17.3/lpc/cmds.c:150:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(line, stbuf.st_mode & 0777) < 0) data/lpr-2008.05.17.3/lpc/cmds.c:442:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(line, stbuf.st_mode & 0777) < 0) data/lpr-2008.05.17.3/lpc/cmds.c:510:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(line, stbuf.st_mode & 0777) < 0) data/lpr-2008.05.17.3/lpc/cmds.c:591:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(line, stbuf.st_mode & 0777) < 0) data/lpr-2008.05.17.3/lpc/cmds.c:755:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(line, stbuf.st_mode & 0777) < 0) data/lpr-2008.05.17.3/lpc/cmds.c:941:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(line, stbuf.st_mode & 0777) < 0) data/lpr-2008.05.17.3/lpc/cmds.c:1030:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. (void)chmod(LO, stbuf.st_mode & 0777); data/lpr-2008.05.17.3/lpd/lpd.c:316:2: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(_PATH_SOCKETNAME, 0660); data/lpr-2008.05.17.3/lpd/lpd.c:317:2: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. chown(_PATH_SOCKETNAME, -1, real_gid); data/lpr-2008.05.17.3/common_source/common.c:457: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(msg, ap); data/lpr-2008.05.17.3/common_source/displayq.c:338:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(head0); data/lpr-2008.05.17.3/common_source/displayq.c:341:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(head1); data/lpr-2008.05.17.3/common_source/rmjob.c:244:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ret ? "cannot dequeue %s\n" : "%s dequeued\n", file); data/lpr-2008.05.17.3/filters/lpf.c:219:26: [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 (name && acctfile && access(acctfile, 02) >= 0 && data/lpr-2008.05.17.3/lpd/lpd.c:468:3: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog(LOG_INFO, /*&sdata,*/ "exiting"); data/lpr-2008.05.17.3/lpd/printjob.c:187:8: [4] (tmpfile) mktemp: Temporary file race condition (CWE-377). (void)mktemp(tempfile); /* safe */ data/lpr-2008.05.17.3/lpd/printjob.c:603:4: [4] (shell) execl: 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. execl(_PATH_PR, "pr", width, length, "-f", data/lpr-2008.05.17.3/lpd/printjob.c:742: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(prog, av); data/lpr-2008.05.17.3/lpd/printjob.c:1123:3: [4] (shell) execl: 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. execl(_PATH_SENDMAIL, cp, "-t", (char *)NULL); data/lpr-2008.05.17.3/lpd/printjob.c:1373:4: [4] (shell) execl: 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. execl(OF, cp, width, length, (char *)NULL); data/lpr-2008.05.17.3/lpd/printjob.c:1641:8: [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. len = vsnprintf(buf, sizeof(buf), msg, ap); data/lpr-2008.05.17.3/lpr/lpr.c:597:8: [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(".", 2) == 0) data/lpr-2008.05.17.3/lpr/lpr.c:601:10: [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. fd = access("/", 2); data/lpr-2008.05.17.3/lpr/lpr.c:604:10: [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. fd = access(file, 2); data/lpr-2008.05.17.3/common_source/displayq.c:107:12: [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 ((p = getenv("COLUMNS")) != NULL) data/lpr-2008.05.17.3/filters/lpf.c:87: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, "crh:i:j:l:n:w:")) != -1) { data/lpr-2008.05.17.3/lpd/lpd.c:172:14: [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 ((i = getopt(argc, argv, "b:dln:rsw:W")) != -1) { data/lpr-2008.05.17.3/lpq/lpq.c:102: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, "alP:w:")) != -1) { data/lpr-2008.05.17.3/lpq/lpq.c:127:46: [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 (!aflag && printer == NULL && (printer = getenv("PRINTER")) == NULL) data/lpr-2008.05.17.3/lpr/lpr.c:158: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, data/lpr-2008.05.17.3/lpr/lpr.c:250:36: [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 (printer == NULL && (printer = getenv("PRINTER")) == NULL) data/lpr-2008.05.17.3/lprm/lprm.c:120: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, "P:w")) != -1) { data/lpr-2008.05.17.3/lprm/lprm.c:141:36: [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 (printer == NULL && (printer = getenv("PRINTER")) == NULL) data/lpr-2008.05.17.3/pac/pac.c:125: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, "P:p:scmr")) != -1) { data/lpr-2008.05.17.3/pac/pac.c:188:36: [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 (printer == NULL && (printer = getenv("PRINTER")) == NULL) data/lpr-2008.05.17.3/common_source/common.c:116: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 line[BUFSIZ]; data/lpr-2008.05.17.3/common_source/common.c:134: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 pbuf[NI_MAXSERV]; data/lpr-2008.05.17.3/common_source/common.c:335: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 lname[NI_MAXHOST], rname[NI_MAXHOST]; data/lpr-2008.05.17.3/common_source/common.c:337: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 errbuf[128]; data/lpr-2008.05.17.3/common_source/common.c:469: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(path, flags|O_NONBLOCK, mode)) < 0 || data/lpr-2008.05.17.3/common_source/common_vars.c:48: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 host[MAXHOSTNAMELEN+1]; /* host machine name */ data/lpr-2008.05.17.3/common_source/common_vars.c:50: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 *printcapdb[2] = { _PATH_PRINTCAP, 0 }; data/lpr-2008.05.17.3/common_source/displayq.c:79: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 current[NAME_MAX]; /* current file being printed */ data/lpr-2008.05.17.3/common_source/displayq.c:80: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 file[NAME_MAX]; /* print file name */ data/lpr-2008.05.17.3/common_source/displayq.c:108:16: [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). termwidth = atoi(p); data/lpr-2008.05.17.3/common_source/displayq.c:190:8: [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). i = atoi(current); data/lpr-2008.05.17.3/common_source/displayq.c:381:36: [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). printf("%-10s %-3d ", line+1, atoi(cf+3)); data/lpr-2008.05.17.3/common_source/displayq.c:513: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 rline[100]; data/lpr-2008.05.17.3/common_source/getcap.c:164: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 pbuf[PATH_MAX]; data/lpr-2008.05.17.3/common_source/getcap.c:182:3: [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(record, toprec, topreclen + 1); data/lpr-2008.05.17.3/common_source/getcap.c:211:9: [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(*db_p, O_RDONLY, 0); data/lpr-2008.05.17.3/common_source/getcap.c:223:7: [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/lpr-2008.05.17.3/common_source/getcap.c:567:28: [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 (pfp == NULL && (pfp = fopen(*dbp, "r")) == NULL) { data/lpr-2008.05.17.3/common_source/getcap.c:587: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). fopen(*dbp, "r")) == NULL) { data/lpr-2008.05.17.3/common_source/getcap.c:630:4: [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(np, line, len); data/lpr-2008.05.17.3/common_source/getcap.c:654:3: [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(buf, nbuf, len); data/lpr-2008.05.17.3/common_source/lp.h:94: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. extern char line[BUFSIZ]; data/lpr-2008.05.17.3/common_source/lp.h:98: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. extern char host[MAXHOSTNAMELEN]; data/lpr-2008.05.17.3/common_source/lp.h:114: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 q_name[MAXNAMLEN+1]; /* control file name */ data/lpr-2008.05.17.3/common_source/rmjob.c:72: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 current[NAME_MAX]; /* active control file name */ data/lpr-2008.05.17.3/common_source/rmjob.c:186: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). cur_daemon = atoi(line); data/lpr-2008.05.17.3/common_source/rmjob.c:333: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/lpr-2008.05.17.3/common_source/startdaemon.c:65: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/lpr-2008.05.17.3/common_source/vis.c:165: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 tbuf[5]; data/lpr-2008.05.17.3/common_source/vis.c:187: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(dst, tbuf, i); data/lpr-2008.05.17.3/filters/lpf.c:63: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 buf[MAXREP][MAXWIDTH]; data/lpr-2008.05.17.3/filters/lpf.c:96:13: [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). if ((i = atoi(optarg)) > 0 && i <= MAXWIDTH) data/lpr-2008.05.17.3/filters/lpf.c:100:13: [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). length = atoi(optarg); data/lpr-2008.05.17.3/filters/lpf.c:103:13: [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). indent = atoi(optarg); data/lpr-2008.05.17.3/lpc/cmds.c:96: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/cmds.c:189: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). if (kill(pid = atoi(line), SIGTERM) < 0) { data/lpr-2008.05.17.3/lpc/cmds.c:207: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 statfile[MAXPATHLEN]; data/lpr-2008.05.17.3/lpc/cmds.c:234: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/cmds.c:390: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/cmds.c:458: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/cmds.c:536: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/cmds.c:573: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[1024]; data/lpr-2008.05.17.3/lpc/cmds.c:655: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/cmds.c:699: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/cmds.c:775: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/cmds.c:888: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/cmds.c:1138: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 prbuf[100]; data/lpr-2008.05.17.3/lpc/lpc.c:78: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 cmdline[MAX_CMDLINE]; data/lpr-2008.05.17.3/lpc/lpc.c:80: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 *margv[MAX_MARGV]; data/lpr-2008.05.17.3/lpd/key.c:151:19: [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). ip->win.ws_col = atoi(ip->arg); data/lpr-2008.05.17.3/lpd/key.c:187:22: [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). cfsetispeed(&ip->t, atoi(ip->arg)); data/lpr-2008.05.17.3/lpd/key.c:209:22: [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). cfsetospeed(&ip->t, atoi(ip->arg)); data/lpr-2008.05.17.3/lpd/key.c:231:19: [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). ip->win.ws_row = atoi(ip->arg); data/lpr-2008.05.17.3/lpd/lpd.c:264: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). lfd = open(_PATH_MASTERLOCK, O_WRONLY|O_CREAT/*|O_EXLOCK*/|O_NONBLOCK, 0644); data/lpr-2008.05.17.3/lpd/lpd.c:479: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 *user[MAXUSERS]; /* users to process */ data/lpr-2008.05.17.3/lpd/lpd.c:485: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 fromb[NI_MAXHOST]; /* buffer for client's machine name */ data/lpr-2008.05.17.3/lpd/lpd.c:486: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 cbuf[BUFSIZ]; /* command line buffer */ data/lpr-2008.05.17.3/lpd/lpd.c:560:25: [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). requ[requests++] = atoi(cp); data/lpr-2008.05.17.3/lpd/lpd.c:596:25: [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). requ[requests++] = atoi(cp); data/lpr-2008.05.17.3/lpd/lpd.c:695: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], ip[NI_MAXHOST]; data/lpr-2008.05.17.3/lpd/lpd.c:696: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 serv[NI_MAXSERV]; data/lpr-2008.05.17.3/lpd/lpd.c:752: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). hostf = fopen(_PATH_HOSTSEQUIV, "r"); data/lpr-2008.05.17.3/lpd/lpd.c:765:11: [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). hostf = fopen(_PATH_HOSTSLPD, "r"); data/lpr-2008.05.17.3/lpd/printjob.c:102: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 title[80]; /* ``pr'' title */ data/lpr-2008.05.17.3/lpd/printjob.c:105: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 class[32]; /* classification field */ data/lpr-2008.05.17.3/lpd/printjob.c:106: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 fromhost[MAXHOSTNAMELEN]; /* user's host machine */ data/lpr-2008.05.17.3/lpd/printjob.c:108: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 indent[10] = "-i0"; data/lpr-2008.05.17.3/lpd/printjob.c:109: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 jobname[NAME_MAX]; /* job or file name */ data/lpr-2008.05.17.3/lpd/printjob.c:110: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 length[10] = "-l"; /* page length in lines */ data/lpr-2008.05.17.3/lpd/printjob.c:111: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 logname[LOGIN_NAME_MAX /*MAXLOGNAME*/]; /* user's login name */ data/lpr-2008.05.17.3/lpd/printjob.c:112: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 pxlength[10] = "-y"; /* page length in pixels */ data/lpr-2008.05.17.3/lpd/printjob.c:113: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 pxwidth[10] = "-x"; /* page width in pixels */ data/lpr-2008.05.17.3/lpd/printjob.c:115: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 width[10] = "-w"; /* page width in static characters */ data/lpr-2008.05.17.3/lpd/printjob.c:153: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(LF, O_WRONLY|O_APPEND, 0664); /* set up log file */ data/lpr-2008.05.17.3/lpd/printjob.c:157:13: [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_DEVNULL, O_WRONLY)) < 0) data/lpr-2008.05.17.3/lpd/printjob.c:329: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 fonts[4][FONTLEN]; /* fonts for troff */ data/lpr-2008.05.17.3/lpd/printjob.c:331: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 ifonts[4][40] = { data/lpr-2008.05.17.3/lpd/printjob.c:549: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 *prog, *av[17], buf[BUFSIZ]; data/lpr-2008.05.17.3/lpd/printjob.c:652:13: [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 ((fo = open(".railmag", O_CREAT|O_WRONLY|O_EXCL, FILMOD)) < 0) { data/lpr-2008.05.17.3/lpd/printjob.c:735: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). n = open(tempfile, O_WRONLY|O_CREAT|O_EXCL, 0664); data/lpr-2008.05.17.3/lpd/printjob.c:803: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, last[BUFSIZ]; data/lpr-2008.05.17.3/lpd/printjob.c:888: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/lpr-2008.05.17.3/lpd/printjob.c:1048: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 outbuf[LINELEN+2], *sp, c, cc; data/lpr-2008.05.17.3/lpd/printjob.c:1151: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). (fp = fopen(tempfile, "r")) == NULL) { data/lpr-2008.05.17.3/lpd/printjob.c:1398:9: [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). port = atoi(LP); data/lpr-2008.05.17.3/lpd/printjob.c:1439:9: [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). pfd = open(LP, RW ? O_RDWR : O_WRONLY); data/lpr-2008.05.17.3/lpd/printjob.c:1630: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/lpr-2008.05.17.3/lpd/printjob.c:1635: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(ST, O_WRONLY|O_CREAT|O_NOFOLLOW /*|O_EXLOCK*/, 0660); data/lpr-2008.05.17.3/lpd/rcmd.c:93: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 domain[MAXHOSTNAMELEN]; data/lpr-2008.05.17.3/lpd/rcmd.c:97: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 buffer[BUFFER_SIZE]; data/lpr-2008.05.17.3/lpd/rcmd.c:246: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 h1[NI_MAXHOST], h2[NI_MAXHOST]; data/lpr-2008.05.17.3/lpd/rcmd.c:291: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 remotehost[NI_MAXHOST]; data/lpr-2008.05.17.3/lpd/rcmd.c:292: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 h1[NI_MAXHOST], h2[NI_MAXHOST]; data/lpr-2008.05.17.3/lpd/recvjob.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 dfname[NAME_MAX]; /* data files */ data/lpr-2008.05.17.3/lpd/recvjob.c:77: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 tfname[NAME_MAX]; /* tmp copy of cf before linking */ data/lpr-2008.05.17.3/lpd/recvjob.c:114:6: [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 (open(LF, O_WRONLY|O_APPEND, 0664) < 0) { data/lpr-2008.05.17.3/lpd/recvjob.c:116:9: [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). (void)open(_PATH_DEVNULL, O_WRONLY); data/lpr-2008.05.17.3/lpd/recvjob.c:242: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/lpr-2008.05.17.3/lpd/recvjob.c:246: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(file, O_CREAT|O_EXCL|O_WRONLY, FILMOD)) < 0) data/lpr-2008.05.17.3/lpd/recvjob.c:320: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 lin[80]; data/lpr-2008.05.17.3/lpd/recvjob.c:323: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 ((fp = fopen(fn, "r")) == NULL) data/lpr-2008.05.17.3/lpd/recvjob.c:330:10: [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). return (atoi(lin)); data/lpr-2008.05.17.3/lpq/lpq.c:76: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 *user[MAXUSERS]; /* users to process */ data/lpr-2008.05.17.3/lpq/lpq.c:134:23: [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). requ[requests++] = atoi(*argv); data/lpr-2008.05.17.3/lpr/lpr.c:86: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 *fonts[4]; /* troff font names */ data/lpr-2008.05.17.3/lpr/lpr.c:127: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[MAXPATHLEN]; data/lpr-2008.05.17.3/lpr/lpr.c:164:9: [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). i = atoi(optarg); data/lpr-2008.05.17.3/lpr/lpr.c:220:34: [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). if ( optarg == 0 || (indent = atoi(optarg)) < 0) data/lpr-2008.05.17.3/lpr/lpr.c:407: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/lpr-2008.05.17.3/lpr/lpr.c:447: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[MAXPATHLEN]; data/lpr-2008.05.17.3/lpr/lpr.c:486: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/lpr-2008.05.17.3/lpr/lpr.c:513:6: [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). f = open(n, O_WRONLY|O_EXCL|O_CREAT, FILMOD); data/lpr-2008.05.17.3/lpr/lpr.c:574: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(file, O_RDONLY|O_NONBLOCK)) < 0) { data/lpr-2008.05.17.3/lpr/lpr.c:623: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 b[10] = "########"; data/lpr-2008.05.17.3/lpr/lpr.c:669: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/lpr-2008.05.17.3/lprm/lprm.c:82: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 *user[MAXUSERS]; /* users to process */ data/lpr-2008.05.17.3/lprm/lprm.c:85: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 luser[LOGIN_NAME_MAX /*MAXLOGNAME*/]; /* buffer for person */ data/lpr-2008.05.17.3/lprm/lprm.c:155:23: [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). requ[requests++] = atoi(argv[0]); data/lpr-2008.05.17.3/lptest/lptest.c:59: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 outbuf[BUFSIZ]; data/lpr-2008.05.17.3/lptest/lptest.c:63:9: [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). len = atoi(argv[1]); data/lpr-2008.05.17.3/lptest/lptest.c:67:11: [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). count = atoi(argv[2]); data/lpr-2008.05.17.3/pac/pac.c:193: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). if ((acct = fopen(acctfile, "r")) == NULL) data/lpr-2008.05.17.3/pac/pac.c:197: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). if ((acct = fopen(sumfile, "r")) != NULL) { data/lpr-2008.05.17.3/pac/pac.c:224: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 linebuf[BUFSIZ]; data/lpr-2008.05.17.3/pac/pac.c:327:15: [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 ((acctf = fopen(sumfile, "w")) == NULL) { data/lpr-2008.05.17.3/pac/pac.c:346:15: [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 ((acctf = fopen(acctfile, "w")) == NULL) data/lpr-2008.05.17.3/common_source/common.c:219:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(cfp)) != '\n' && linel+1<sizeof(line)) { data/lpr-2008.05.17.3/common_source/displayq.c:160:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = read(fd, line, sizeof(line))) > 0) data/lpr-2008.05.17.3/common_source/displayq.c:185:16: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = getc(fp)) != EOF && i != '\n') { data/lpr-2008.05.17.3/common_source/displayq.c:204:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = getc(fp)) != EOF && i != '\n') { data/lpr-2008.05.17.3/common_source/displayq.c:218:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = read(fd, line, sizeof(line))) > 0) data/lpr-2008.05.17.3/common_source/displayq.c:257: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). cp += strlen(cp); data/lpr-2008.05.17.3/common_source/displayq.c:261: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). cp += strlen(cp); data/lpr-2008.05.17.3/common_source/displayq.c:264: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). cp += strlen(cp); data/lpr-2008.05.17.3/common_source/displayq.c:269: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). cp += strlen(cp); data/lpr-2008.05.17.3/common_source/displayq.c:288: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). i = strlen(line); data/lpr-2008.05.17.3/common_source/displayq.c:299:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = read(fd, line, sizeof(line))) > 0) { data/lpr-2008.05.17.3/common_source/displayq.c:339: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). col = strlen(head0)+1; data/lpr-2008.05.17.3/common_source/displayq.c:373: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). col = strlen(line+1) + 2; data/lpr-2008.05.17.3/common_source/displayq.c:467:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (((n = strlen(nfile)) + col + fill) >= data/lpr-2008.05.17.3/common_source/displayq.c:527: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). col += strlen(rline); data/lpr-2008.05.17.3/common_source/getcap.c:248:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(fd, buf, sizeof(buf)); data/lpr-2008.05.17.3/common_source/rmjob.c:260: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(file) < 7 || file[0] != 'c' || file[1] != 'f') data/lpr-2008.05.17.3/common_source/rmjob.c:379: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). i = strlen(buf); data/lpr-2008.05.17.3/common_source/rmjob.c:382:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = read(rem, buf, sizeof(buf))) > 0) data/lpr-2008.05.17.3/common_source/startdaemon.c:105:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(s, buf, 1) == 1) { data/lpr-2008.05.17.3/common_source/startdaemon.c:112:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(s, buf, sizeof(buf))) > 0) data/lpr-2008.05.17.3/common_source/strlcat.c:44: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). return(dlen + strlen(s)); data/lpr-2008.05.17.3/filters/lpf.c:130:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). switch (ch = getc(p)) { data/lpr-2008.05.17.3/filters/lpf.c:163:15: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((ch = getchar()) == '\1') { data/lpr-2008.05.17.3/lpc/cmds.c:222: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). (void)write(fd, msg, strlen(msg)); data/lpr-2008.05.17.3/lpc/cmds.c:634: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). (void)write(fd, buf, strlen(buf)); data/lpr-2008.05.17.3/lpc/cmds.c:872:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = read(fd, line, sizeof(line))) > 0) data/lpr-2008.05.17.3/lpc/lpc.c:245: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). int len = strlen(c->c_name); data/lpr-2008.05.17.3/lpc/lpc.c:264: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). w = strlen(c->c_name); data/lpr-2008.05.17.3/lpd/lpd.c:262:8: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(0); data/lpr-2008.05.17.3/lpd/lpd.c:278: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). f = strlen(line); data/lpr-2008.05.17.3/lpd/lpd.c:319:8: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(0); /* XXX */ data/lpr-2008.05.17.3/lpd/lpd.c:507:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((n = read(STDOUT_FILENO, cp, 1)) != 1) { data/lpr-2008.05.17.3/lpd/printjob.c:316:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (void)write(ofd, FF, strlen(FF)); data/lpr-2008.05.17.3/lpd/printjob.c:318:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (void)write(ofd, TR, strlen(TR)); data/lpr-2008.05.17.3/lpd/printjob.c:568: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). (void)write(ofd, FF, strlen(FF)); data/lpr-2008.05.17.3/lpd/printjob.c:573:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(fi, buf, BUFSIZ)) > 0) data/lpr-2008.05.17.3/lpd/printjob.c:660: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). (void)write(fo, fonts[n], strlen(fonts[n])); data/lpr-2008.05.17.3/lpd/printjob.c:769:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((nread = read(fd, buf, sizeof(buf))) > 0) data/lpr-2008.05.17.3/lpd/printjob.c:931:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (sizerr == 0 && read(f, buf, amt) != amt) data/lpr-2008.05.17.3/lpd/printjob.c:978:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(pfd, &resp, 1) != 1) { data/lpr-2008.05.17.3/lpd/printjob.c:997: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). (void)write(ofd, FF, strlen(FF)); data/lpr-2008.05.17.3/lpd/printjob.c:1000: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). (void)write(ofd, class, strlen(class)); data/lpr-2008.05.17.3/lpd/printjob.c:1003: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). (void)write(ofd, name1, strlen(name1)); data/lpr-2008.05.17.3/lpd/printjob.c:1005: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). (void)write(ofd, name2, strlen(name2)); data/lpr-2008.05.17.3/lpd/printjob.c:1019: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). (void)write(ofd, name2, strlen(name2)); data/lpr-2008.05.17.3/lpd/printjob.c:1025: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). (void)write(ofd, FF, strlen(FF)); data/lpr-2008.05.17.3/lpd/printjob.c:1156:16: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = getc(fp)) != EOF) data/lpr-2008.05.17.3/lpd/printjob.c:1634:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); data/lpr-2008.05.17.3/lpd/rcmd.c:102: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). buflen = strlen( buffer ); data/lpr-2008.05.17.3/lpd/rcmd.c:147: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(ahost) >= MAXHOSTNAMELEN) data/lpr-2008.05.17.3/lpd/recvjob.c:157:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(STDOUT_FILENO, cp, 1)) != 1) { data/lpr-2008.05.17.3/lpd/recvjob.c:256:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). j = read(STDOUT_FILENO, cp, amt); data/lpr-2008.05.17.3/lpd/recvjob.c:287:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(STDOUT_FILENO, &resp, 1) != 1) data/lpr-2008.05.17.3/lpr/lpr.c:373:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(tfd, &c, 1) == 1 && data/lpr-2008.05.17.3/lpr/lpr.c:417:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = read(f, buf, sizeof(buf))) > 0) { data/lpr-2008.05.17.3/lpr/lpr.c:490: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(p2) > sizeof(buf) - 2) data/lpr-2008.05.17.3/lpr/lpr.c:510:17: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). int oldumask = umask(0); /* should block signals */ data/lpr-2008.05.17.3/lpr/lpr.c:514:8: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(oldumask); data/lpr-2008.05.17.3/lpr/lpr.c:681:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = read(fd, buf, sizeof(buf))) > 0) { data/lpr-2008.05.17.3/lpr/lpr.c:695: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). inchar = strlen(SD) + 3; data/lpr-2008.05.17.3/lpr/lpr.c:698: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). (void)write(fd, buf, strlen(buf)); data/lpr-2008.05.17.3/lprm/lprm.c:116: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(pw->pw_name) >= sizeof(luser)) data/lpr-2008.05.17.3/lprm/lprm.c:144: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(argc == 1 && *argv[0] == '-' && strlen(argv[0]) == 1) { data/lpr-2008.05.17.3/pac/pac.c:460: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(acctfile) + 5; ANALYSIS SUMMARY: Hits = 226 Lines analyzed = 11962 in approximately 0.34 seconds (35113 lines/second) Physical Source Lines of Code (SLOC) = 8771 Hits@level = [0] 291 [1] 65 [2] 126 [3] 11 [4] 15 [5] 9 Hits@level+ = [0+] 517 [1+] 226 [2+] 161 [3+] 35 [4+] 24 [5+] 9 Hits/KSLOC@level+ = [0+] 58.9442 [1+] 25.7667 [2+] 18.3559 [3+] 3.99042 [4+] 2.73629 [5+] 1.02611 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.