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/globus-gatekeeper-11.3/globus_gatekeeper.c Examining data/globus-gatekeeper-11.3/globus_k5.c Examining data/globus-gatekeeper-11.3/globus_gatekeeper_utils.h Examining data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c FINAL RESULTS: data/globus-gatekeeper-11.3/globus_gatekeeper.c:1681:13: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. chown(proxyfile,service_uid,service_gid); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1696:13: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. chown(ccname+5,service_uid,service_gid); data/globus-gatekeeper-11.3/globus_k5.c:178:11: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. (void) chown(ccname+5,pw->pw_uid, pw->pw_gid); data/globus-gatekeeper-11.3/globus_gatekeeper.c:174:25: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define notice2(i,a,b) {sprintf(tmpbuf, a,b); notice(i,tmpbuf);} data/globus-gatekeeper-11.3/globus_gatekeeper.c:175:27: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define notice3(i,a,b,c) {sprintf(tmpbuf, a,b,c); notice(i,tmpbuf);} data/globus-gatekeeper-11.3/globus_gatekeeper.c:176:29: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define notice4(i,a,b,c,d) {sprintf(tmpbuf, a,b,c,d); notice(i,tmpbuf);} data/globus-gatekeeper-11.3/globus_gatekeeper.c:177:31: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define notice5(i,a,b,c,d,e) {sprintf(tmpbuf, a,b,c,d,e); notice(i,tmpbuf);} data/globus-gatekeeper-11.3/globus_gatekeeper.c:178:26: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define failure2(t,a,b) {sprintf(tmpbuf, a,b); failure(t,tmpbuf);} data/globus-gatekeeper-11.3/globus_gatekeeper.c:179:28: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define failure3(t,a,b,c) {sprintf(tmpbuf, a,b,c); failure(t,tmpbuf);} data/globus-gatekeeper-11.3/globus_gatekeeper.c:180:30: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define failure4(t,a,b,c,d) {sprintf(tmpbuf, a,b,c,d); failure(t,tmpbuf);} data/globus-gatekeeper-11.3/globus_gatekeeper.c:348:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(oldpath, "%s.%04d%02d%02d%02d%02d%02d.%d", acctpath, data/globus-gatekeeper-11.3/globus_gatekeeper.c:449:13: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(newfilename, prefix); data/globus-gatekeeper-11.3/globus_gatekeeper.c:455:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(newfilename, evaluated_path); data/globus-gatekeeper-11.3/globus_gatekeeper.c:463:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(newfilename, sufix); data/globus-gatekeeper-11.3/globus_gatekeeper.c:865:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(libexecdir, "%s/libexec", gatekeeperhome); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1050:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(contact_string, "%s:%d:%s", data/globus-gatekeeper-11.3/globus_gatekeeper.c:1322:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access("/etc/nologin", F_OK) == 0) data/globus-gatekeeper-11.3/globus_gatekeeper.c:1329:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. access(genfilename(gatekeeperhome,"etc",globusnologin), F_OK) == 0) data/globus-gatekeeper-11.3/globus_gatekeeper.c:1335:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access("/etc/globus-nologin", F_OK) == 0) data/globus-gatekeeper-11.3/globus_gatekeeper.c:1746:13: [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(gram_k5_path, X_OK) != 0) data/globus-gatekeeper-11.3/globus_gatekeeper.c:2077:13: [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. if (execv(execp, args) != 0) data/globus-gatekeeper-11.3/globus_gatekeeper.c:2079:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmpbuf, "Exec failed: %s\n", strerror(errno)); data/globus-gatekeeper-11.3/globus_gatekeeper.c:2140:17: [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(reply, header); data/globus-gatekeeper-11.3/globus_gatekeeper.c:2266:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(oldpath, "%s.%04d%02d%02d%02d%02d%02d.%d", logpath, data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:286:3: [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(narg,cp); data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:287:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(narg,rp); data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:288:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(narg,qp); data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:358:5: [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(path, args); data/globus-gatekeeper-11.3/globus_k5.c:109:21: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DEEDEBUG(A) fprintf(stderrX,A) data/globus-gatekeeper-11.3/globus_k5.c:110:24: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DEEDEBUG2(A,B) fprintf(stderrX,A,B) data/globus-gatekeeper-11.3/globus_k5.c:359:7: [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(newpath,newargv); data/globus-gatekeeper-11.3/globus_gatekeeper.c:271:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. globusid = getenv("GLOBUSID"); data/globus-gatekeeper-11.3/globus_gatekeeper.c:852:32: [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. else if ((gatekeeperhome = getenv("GLOBUS_LOCATION")) != NULL) data/globus-gatekeeper-11.3/globus_gatekeeper.c:1018:16: [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. fqdn = getenv("GLOBUS_HOSTNAME"); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1328:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("GLOBUS_LOCATION") != NULL && data/globus-gatekeeper-11.3/globus_gatekeeper.c:1522:15: [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. genfilename(getenv("GLOBUS_LOCATION") ? gatekeeperhome : "",grid_services,service_name), data/globus-gatekeeper-11.3/globus_gatekeeper.c:1679:26: [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 ((proxyfile = getenv("X509_USER_PROXY")) != NULL) data/globus-gatekeeper-11.3/globus_gatekeeper.c:1692:23: [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 ((ccname = getenv("KRB5CCNAME")) != NULL data/globus-gatekeeper-11.3/globus_gatekeeper.c:1808:26: [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 ((x509_delegate = getenv("X509_USER_DELEG_PROXY"))) data/globus-gatekeeper-11.3/globus_gatekeeper_utils.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. if (!(rp = getenv(pp))) data/globus-gatekeeper-11.3/globus_k5.c:146:47: [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 ((rc = globus_gatekeeper_util_globusxmap(getenv("GLOBUSKMAP"), data/globus-gatekeeper-11.3/globus_k5.c:218:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. user = getenv("USER"); data/globus-gatekeeper-11.3/globus_k5.c:256: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. ccname = getenv("KRB5CCNAME"); data/globus-gatekeeper-11.3/globus_k5.c:266:15: [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. globusid = getenv("GLOBUS_ID"); data/globus-gatekeeper-11.3/globus_k5.c:272: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. ccname = getenv("KRB5CCNAME"); data/globus-gatekeeper-11.3/globus_gatekeeper.c:173: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 tmpbuf[1024]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:384: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). acct_fd = open(acctpath, O_WRONLY | O_APPEND | O_CREAT, 0644); data/globus-gatekeeper-11.3/globus_gatekeeper.c:399:6: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:401:6: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "%d", acct_fd); data/globus-gatekeeper-11.3/globus_gatekeeper.c:547:16: [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("/dev/null",O_WRONLY); data/globus-gatekeeper-11.3/globus_gatekeeper.c:586:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). pfd = open(argv[2],O_RDONLY); data/globus-gatekeeper-11.3/globus_gatekeeper.c:631:27: [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). daemon_port = atoi(argv[i+1]); data/globus-gatekeeper-11.3/globus_gatekeeper.c:684: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). log_facility = atoi(facilitystring); data/globus-gatekeeper-11.3/globus_gatekeeper.c:924:16: [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("/dev/null",O_WRONLY); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1012: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. char hostname[255] = ""; data/globus-gatekeeper-11.3/globus_gatekeeper.c:1089:10: [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("/dev/null",O_WRONLY); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1101:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fname[256]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:1104:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fname, "/dev/console"); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1105:22: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open (fname, O_RDWR); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1109:21: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fname, "/dev/tty"); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1110:26: [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 (fname, O_RDWR); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1115:21: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fname, "/dev/null"); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1116:26: [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 (fname, O_RDWR); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1128:24: [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("/dev/null", O_RDONLY); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1130:22: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open("/dev/tty", O_RDWR); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1147:23: [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). pidfile = fopen(pidpath, "w"); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1177:29: [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). ttyfd = open("/dev/tty",O_RDWR); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1240:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:1246:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char * service_args[SERVICE_ARGS_MAX]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:1249:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char * service_options[SERVICE_OPTIONS_MAX]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:1253:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char int_buf[4]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:1276:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char identity_buffer[256]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:1429:13: [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(service_name, header + matches[2].rm_so, matchlen); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1442:13: [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(mapping, header + matches[4].rm_so, matchlen); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1455: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 gatekeeper_jm_id[64]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:1460:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(gatekeeper_jm_id, "%04d-%02d-%02d.%02d:%02d:%02d.%010u.%010u", data/globus-gatekeeper-11.3/globus_gatekeeper.c:1840:27: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). context_tmpfile = tmpfile(); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1845:13: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "%d", fileno(context_tmpfile)); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1903:26: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). http_body_file = tmpfile(); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1908:13: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "%d", fileno(http_body_file)); data/globus-gatekeeper-11.3/globus_gatekeeper.c:2141:17: [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(reply + sizeof(header) - 1, buf, n); data/globus-gatekeeper-11.3/globus_gatekeeper.c:2252:6: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[128]; data/globus-gatekeeper-11.3/globus_gatekeeper.c:2254:6: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "logfile rotating at %04d-%02d-%02d %02d:%02d:%02d", data/globus-gatekeeper-11.3/globus_gatekeeper.c:2424:30: [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 ((usrlog_fp = fopen(logfilename, "a")) == NULL) data/globus-gatekeeper-11.3/globus_gatekeeper.c:2685:13: [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(header + header_len, tmp, tmplen); data/globus-gatekeeper-11.3/globus_gatekeeper.c:2710:21: [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(body, t, body_len); data/globus-gatekeeper-11.3/globus_gatekeeper.c:2731:13: [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(body + body_len, tmp, tmplen); data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:113: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 f_index[256]; data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c: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 line[4096]; data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:118:13: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = fopen(filename, "r")) != NULL) { data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:225: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(*arg,pp,qp - pp); data/globus-gatekeeper-11.3/globus_k5.c:141: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 ccname[100]; data/globus-gatekeeper-11.3/globus_k5.c:143: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 * args[100]; data/globus-gatekeeper-11.3/globus_k5.c:162:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(ccname,"FILE:/tmp/krb5cc_p%d.%d",getpid(),i++); data/globus-gatekeeper-11.3/globus_gatekeeper.c:343:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char *oldpath = malloc(strlen(acctpath) + 64); data/globus-gatekeeper-11.3/globus_gatekeeper.c:434: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). prefixl = strlen(prefix); data/globus-gatekeeper-11.3/globus_gatekeeper.c:435: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). sufixl = strlen(sufix); data/globus-gatekeeper-11.3/globus_gatekeeper.c:442: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). pathl = strlen(evaluated_path); data/globus-gatekeeper-11.3/globus_gatekeeper.c:452:17: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(newfilename, "/"); data/globus-gatekeeper-11.3/globus_gatekeeper.c:461:13: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(newfilename, "/"); data/globus-gatekeeper-11.3/globus_gatekeeper.c:587:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). i = read(pfd, newbuf, BUFSIZ-1); data/globus-gatekeeper-11.3/globus_gatekeeper.c:864:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). libexecdir = malloc(strlen(gatekeeperhome) + strlen("/libexec") + 1); data/globus-gatekeeper-11.3/globus_gatekeeper.c:864: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). libexecdir = malloc(strlen(gatekeeperhome) + strlen("/libexec") + 1); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1046:46: [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 ((contact_string = (char *)malloc(strlen(fqdn) data/globus-gatekeeper-11.3/globus_gatekeeper.c:1047:48: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). + strlen(globusid) + 40))) data/globus-gatekeeper-11.3/globus_gatekeeper.c:1058:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (!run_from_inetd && strlen(contact_string)<sizeof(tmpbuf)-15) data/globus-gatekeeper-11.3/globus_gatekeeper.c:1496:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(&identity_buffer[0], mapping, sizeof(identity_buffer)); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1501: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). length = strlen(service_name); data/globus-gatekeeper-11.3/globus_gatekeeper.c:1693: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). && strlen(ccname) > 5 data/globus-gatekeeper-11.3/globus_gatekeeper.c:2047: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). tmp += strlen(host); data/globus-gatekeeper-11.3/globus_gatekeeper.c:2080:51: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). write(close_on_exec_write_fd, tmpbuf, strlen(tmpbuf)); data/globus-gatekeeper-11.3/globus_gatekeeper.c:2099:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((n = read(close_on_exec_read_fd, buf, sizeof(buf))) > 0) data/globus-gatekeeper-11.3/globus_gatekeeper.c:2133:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(proxy_socket[0], buf, sizeof(buf))) > 0) data/globus-gatekeeper-11.3/globus_gatekeeper.c:2264: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). char *oldpath = malloc(strlen(logpath) + 64); data/globus-gatekeeper-11.3/globus_gatekeeper.c:2403: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 (strlen(logfile) > 0) data/globus-gatekeeper-11.3/globus_gatekeeper.c:2558: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). strlen(response) + 1, data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:84: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). (i = strlen(line)) > 2 && data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:121: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). i = strlen(line); data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:136:15: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. rc = sscanf(line, "%255s%n %n", data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:280:31: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (!(narg = (char *)malloc(strlen(cp) + data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:281: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). strlen(rp) + data/globus-gatekeeper-11.3/globus_gatekeeper_utils.c:282: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). strlen(qp) + 1))) ANALYSIS SUMMARY: Hits = 122 Lines analyzed = 3644 in approximately 0.13 seconds (29053 lines/second) Physical Source Lines of Code (SLOC) = 2528 Hits@level = [0] 38 [1] 28 [2] 49 [3] 14 [4] 28 [5] 3 Hits@level+ = [0+] 160 [1+] 122 [2+] 94 [3+] 45 [4+] 31 [5+] 3 Hits/KSLOC@level+ = [0+] 63.2911 [1+] 48.2595 [2+] 37.1835 [3+] 17.8006 [4+] 12.2627 [5+] 1.18671 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.