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/cups-pdf-3.0.1/src/cups-pdf.c Examining data/cups-pdf-3.0.1/src/cups-pdf.h FINAL RESULTS: data/cups-pdf-3.0.1/src/cups-pdf.c:127:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(dirname,fstatus.st_uid,fstatus.st_gid)!=0) data/cups-pdf-3.0.1/src/cups-pdf.c:383:11: [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(Conf_Log, 0700)) data/cups-pdf-3.0.1/src/cups-pdf.c:410:9: [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(Conf_Spool, 0751)) { data/cups-pdf-3.0.1/src/cups-pdf.c:414:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(Conf_Spool, -1, group->gr_gid)) data/cups-pdf-3.0.1/src/cups-pdf.c:494:11: [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(dirname, (mode_t)(0777&~Conf_AnonUMask))) { data/cups-pdf-3.0.1/src/cups-pdf.c:505:11: [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(dirname, (mode_t)(0777&~Conf_UserUMask))) { data/cups-pdf-3.0.1/src/cups-pdf.c:511:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(dirname, passwd->pw_uid, passwd->pw_gid)) { data/cups-pdf-3.0.1/src/cups-pdf.c:723:7: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(spoolfile, passwd->pw_uid, -1)) { data/cups-pdf-3.0.1/src/cups-pdf.c:1054:9: [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(outfile, mode)) data/cups-pdf-3.0.1/src/cups-pdf.c:89:5: [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. vsnprintf(logbuffer, BUFSIZE, message, ap); data/cups-pdf-3.0.1/src/cups-pdf.c:260:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. if (sscanf(buffer,"%s %[^\n]",key,value)) { data/cups-pdf-3.0.1/src/cups-pdf.c:363:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/cups-pdf-%s.conf", CP_CONFIG_PATH, uri); data/cups-pdf-3.0.1/src/cups-pdf.c:366:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/cups-pdf.conf", CP_CONFIG_PATH); data/cups-pdf-3.0.1/src/cups-pdf.c:804:7: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(buffer, title); data/cups-pdf-3.0.1/src/cups-pdf.c:1012:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(gscall, size, Conf_GSCall, Conf_GhostScript, Conf_PDFVer, outfile, spoolfile); data/cups-pdf-3.0.1/src/cups-pdf.c:1052:10: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. size=system(gscall); data/cups-pdf-3.0.1/src/cups-pdf.c:1067:14: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. size=system(ppcall); data/cups-pdf-3.0.1/src/cups-pdf.c:276:14: [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. ppd_name = getenv("PPD"); data/cups-pdf-3.0.1/src/cups-pdf.c:386:69: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. snprintf(filename, BUFSIZE, "%s/%s%s%s", Conf_Log, "cups-pdf-", getenv("PRINTER"), "_log"); data/cups-pdf-3.0.1/src/cups-pdf.c:1031:56: [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. log_event(CPDEBUG, "TMPDIR set for GhostScript: %s", getenv("TMPDIR")); data/cups-pdf-3.0.1/src/cups-pdf.c:72: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 ctype[8], *timestring; data/cups-pdf-3.0.1/src/cups-pdf.c:104: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 buffer[BUFSIZE],*delim; data/cups-pdf-3.0.1/src/cups-pdf.c:193: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). tmp=atoi(value); data/cups-pdf-3.0.1/src/cups-pdf.c:197: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). tmp=atoi(value); data/cups-pdf-3.0.1/src/cups-pdf.c:201: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). tmp=atoi(value); data/cups-pdf-3.0.1/src/cups-pdf.c:205: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). tmp=atoi(value); data/cups-pdf-3.0.1/src/cups-pdf.c:209: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). tmp=atoi(value); data/cups-pdf-3.0.1/src/cups-pdf.c:213: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). tmp=atoi(value); data/cups-pdf-3.0.1/src/cups-pdf.c:217: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). tmp=atoi(value); data/cups-pdf-3.0.1/src/cups-pdf.c:221: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). tmp=atoi(value); data/cups-pdf-3.0.1/src/cups-pdf.c:225: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). tmp=atoi(value); data/cups-pdf-3.0.1/src/cups-pdf.c:250:8: [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(filename,"r"); data/cups-pdf-3.0.1/src/cups-pdf.c:387: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). logfp=fopen(filename, "a"); data/cups-pdf-3.0.1/src/cups-pdf.c:448: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 bufin[BUFSIZE], bufout[BUFSIZE], *needle, *cptr; data/cups-pdf-3.0.1/src/cups-pdf.c:716: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). fpdest=fopen(spoolfile, "w"); data/cups-pdf-3.0.1/src/cups-pdf.c:957:60: [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 (preparespoolfile(stdin, spoolfile, title, argv[3], atoi(argv[1]), passwd)) { data/cups-pdf-3.0.1/src/cups-pdf.c:968:26: [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 (preparespoolfile(fopen(argv[6], "r"), spoolfile, title, argv[3], atoi(argv[1]), passwd)) { data/cups-pdf-3.0.1/src/cups-pdf.c:968:74: [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 (preparespoolfile(fopen(argv[6], "r"), spoolfile, title, argv[3], atoi(argv[1]), passwd)) { data/cups-pdf-3.0.1/src/cups-pdf.h:38: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. typedef char cp_string[BUFSIZE]; data/cups-pdf-3.0.1/src/cups-pdf.c:79:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). timestring[strlen(timestring)-1]='\0'; data/cups-pdf-3.0.1/src/cups-pdf.c:107: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). while ((i=strlen(dirname))>1 && dirname[i-1]=='/') data/cups-pdf-3.0.1/src/cups-pdf.c:110:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer,dirname,BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:154:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_AnonDirName, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:157:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_AnonUser, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:160:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_GhostScript, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:163:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_GSCall, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:166:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_Grp, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:172:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_Log, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:175:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_PDFVer, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:178:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_PostProcessing, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:181:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_Out, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:184:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_Spool, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:187:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_UserPrefix, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:190:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Conf_RemovePrefix, value, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:248:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((strlen(filename) > 1) && (!stat(filename, &fstatus)) && data/cups-pdf-3.0.1/src/cups-pdf.c:261: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). if (!strlen(key) || !strncmp(key,"#",1)) data/cups-pdf-3.0.1/src/cups-pdf.c:361:65: [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 ((uri != NULL) && (strncmp(uri, "cups-pdf:/", 10) == 0) && strlen(uri) > 10) { data/cups-pdf-3.0.1/src/cups-pdf.c:374:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(0077); data/cups-pdf-3.0.1/src/cups-pdf.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). if (strlen(Conf_Log)) { data/cups-pdf-3.0.1/src/cups-pdf.c:403:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(0022); data/cups-pdf-3.0.1/src/cups-pdf.c:419:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(0077); data/cups-pdf-3.0.1/src/cups-pdf.c:433: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). len = strlen(config_ent->d_name); data/cups-pdf-3.0.1/src/cups-pdf.c:436:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(setup, config_ent->d_name + 9, BUFSIZE>len-14 ? len-14 : BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:451: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). if ((int)strlen(uname)>(size=strlen(Conf_RemovePrefix))) data/cups-pdf-3.0.1/src/cups-pdf.c:451:32: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((int)strlen(uname)>(size=strlen(Conf_RemovePrefix))) data/cups-pdf-3.0.1/src/cups-pdf.c:454:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(bufin, Conf_Out, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:462:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(bufin, bufout, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:474:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(bufin, bufout, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:476: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). size=strlen(bufin)+1; data/cups-pdf-3.0.1/src/cups-pdf.c:487:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(0000); data/cups-pdf-3.0.1/src/cups-pdf.c:517:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(0077); data/cups-pdf-3.0.1/src/cups-pdf.c:598: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). for (i=0;i<(unsigned int)strlen(string);i++) data/cups-pdf-3.0.1/src/cups-pdf.c:610: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). for (i=0;i<(unsigned int)strlen(string);i++) data/cups-pdf-3.0.1/src/cups-pdf.c:635: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(title); data/cups-pdf-3.0.1/src/cups-pdf.c:638: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 (i<strlen(title)-1) { data/cups-pdf-3.0.1/src/cups-pdf.c:646:35: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memmove(title, title+i-1, strlen(title)-i+2); data/cups-pdf-3.0.1/src/cups-pdf.c:649: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). while (strlen(title)>2 && title[0]=='(' && title[strlen(title)-1]==')') { data/cups-pdf-3.0.1/src/cups-pdf.c:649:54: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). while (strlen(title)>2 && title[0]=='(' && title[strlen(title)-1]==')') { data/cups-pdf-3.0.1/src/cups-pdf.c:651: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). title[strlen(title)-1]='\0'; data/cups-pdf-3.0.1/src/cups-pdf.c:652: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). memmove(title, title+1, strlen(title)); data/cups-pdf-3.0.1/src/cups-pdf.c:658: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). memmove(title, cut+1, strlen(cut+1)+1); data/cups-pdf-3.0.1/src/cups-pdf.c:663: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). memmove(title, cut+1, strlen(cut+1)+1); data/cups-pdf-3.0.1/src/cups-pdf.c:666:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((cut != NULL) && ((int)strlen(cut) <= Conf_Cut+1) && (cut != title)) { data/cups-pdf-3.0.1/src/cups-pdf.c:670: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(title)>Conf_Truncate) { data/cups-pdf-3.0.1/src/cups-pdf.c:689:7: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c=fgetc(ffpsrc); /* converts CR/LF to LF in some OSses */ data/cups-pdf-3.0.1/src/cups-pdf.c:770:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, cmdtitle, BUFSIZE); data/cups-pdf-3.0.1/src/cups-pdf.c:843: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). size=strlen(Conf_UserPrefix)+strlen(argv[2])+1; data/cups-pdf-3.0.1/src/cups-pdf.c:843: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). size=strlen(Conf_UserPrefix)+strlen(argv[2])+1; data/cups-pdf-3.0.1/src/cups-pdf.c:853: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). for (size=0;size<(int) strlen(argv[2]);size++) data/cups-pdf-3.0.1/src/cups-pdf.c:856: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). size=strlen(Conf_UserPrefix)+strlen(argv[2])+1; data/cups-pdf-3.0.1/src/cups-pdf.c:856:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size=strlen(Conf_UserPrefix)+strlen(argv[2])+1; data/cups-pdf-3.0.1/src/cups-pdf.c:861:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(Conf_AnonUser)) { data/cups-pdf-3.0.1/src/cups-pdf.c:871: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). size=strlen(Conf_AnonDirName)+4; data/cups-pdf-3.0.1/src/cups-pdf.c:881: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). while (strlen(dirname) && ((dirname[strlen(dirname)-1] == '\n') || data/cups-pdf-3.0.1/src/cups-pdf.c:881:43: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). while (strlen(dirname) && ((dirname[strlen(dirname)-1] == '\n') || data/cups-pdf-3.0.1/src/cups-pdf.c:882: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). (dirname[strlen(dirname)-1] == '\r'))) data/cups-pdf-3.0.1/src/cups-pdf.c:883: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). dirname[strlen(dirname)-1]='\0'; data/cups-pdf-3.0.1/src/cups-pdf.c:904: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). while (strlen(dirname) && ((dirname[strlen(dirname)-1] == '\n') || data/cups-pdf-3.0.1/src/cups-pdf.c:904:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). while (strlen(dirname) && ((dirname[strlen(dirname)-1] == '\n') || data/cups-pdf-3.0.1/src/cups-pdf.c:905:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (dirname[strlen(dirname)-1] == '\r'))) data/cups-pdf-3.0.1/src/cups-pdf.c:906:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). dirname[strlen(dirname)-1]='\0'; data/cups-pdf-3.0.1/src/cups-pdf.c:943: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). size=strlen(Conf_Spool)+22; data/cups-pdf-3.0.1/src/cups-pdf.c:979: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). size=strlen(dirname)+strlen(title)+strlen(Conf_OutExtension)+3; data/cups-pdf-3.0.1/src/cups-pdf.c:979: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). size=strlen(dirname)+strlen(title)+strlen(Conf_OutExtension)+3; data/cups-pdf-3.0.1/src/cups-pdf.c:979:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size=strlen(dirname)+strlen(title)+strlen(Conf_OutExtension)+3; data/cups-pdf-3.0.1/src/cups-pdf.c:992: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(Conf_OutExtension)) data/cups-pdf-3.0.1/src/cups-pdf.c:998: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). size=strlen(Conf_GSCall)+strlen(Conf_GhostScript)+strlen(Conf_PDFVer)+strlen(outfile)+strlen(spoolfile)+6; data/cups-pdf-3.0.1/src/cups-pdf.c:998: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). size=strlen(Conf_GSCall)+strlen(Conf_GhostScript)+strlen(Conf_PDFVer)+strlen(outfile)+strlen(spoolfile)+6; data/cups-pdf-3.0.1/src/cups-pdf.c:998:53: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size=strlen(Conf_GSCall)+strlen(Conf_GhostScript)+strlen(Conf_PDFVer)+strlen(outfile)+strlen(spoolfile)+6; data/cups-pdf-3.0.1/src/cups-pdf.c:998:73: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size=strlen(Conf_GSCall)+strlen(Conf_GhostScript)+strlen(Conf_PDFVer)+strlen(outfile)+strlen(spoolfile)+6; data/cups-pdf-3.0.1/src/cups-pdf.c:998:89: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size=strlen(Conf_GSCall)+strlen(Conf_GhostScript)+strlen(Conf_PDFVer)+strlen(outfile)+strlen(spoolfile)+6; data/cups-pdf-3.0.1/src/cups-pdf.c:1051:12: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(0077); data/cups-pdf-3.0.1/src/cups-pdf.c:1059:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(Conf_PostProcessing)) { data/cups-pdf-3.0.1/src/cups-pdf.c:1060: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). size=strlen(Conf_PostProcessing)+strlen(outfile)+strlen(passwd->pw_name)+strlen(argv[2])+4; data/cups-pdf-3.0.1/src/cups-pdf.c:1060:40: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size=strlen(Conf_PostProcessing)+strlen(outfile)+strlen(passwd->pw_name)+strlen(argv[2])+4; data/cups-pdf-3.0.1/src/cups-pdf.c:1060:56: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size=strlen(Conf_PostProcessing)+strlen(outfile)+strlen(passwd->pw_name)+strlen(argv[2])+4; data/cups-pdf-3.0.1/src/cups-pdf.c:1060:80: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size=strlen(Conf_PostProcessing)+strlen(outfile)+strlen(passwd->pw_name)+strlen(argv[2])+4; ANALYSIS SUMMARY: Hits = 117 Lines analyzed = 1210 in approximately 0.10 seconds (11709 lines/second) Physical Source Lines of Code (SLOC) = 1031 Hits@level = [0] 28 [1] 78 [2] 19 [3] 3 [4] 8 [5] 9 Hits@level+ = [0+] 145 [1+] 117 [2+] 39 [3+] 20 [4+] 17 [5+] 9 Hits/KSLOC@level+ = [0+] 140.64 [1+] 113.482 [2+] 37.8274 [3+] 19.3986 [4+] 16.4888 [5+] 8.72939 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.