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/sxid-4.20130802/src/conffile.c Examining data/sxid-4.20130802/src/search.c Examining data/sxid-4.20130802/src/notify.c Examining data/sxid-4.20130802/src/getopt1.c Examining data/sxid-4.20130802/src/sxid.h Examining data/sxid-4.20130802/src/logging.c Examining data/sxid-4.20130802/src/sha2.c Examining data/sxid-4.20130802/src/getopt.h Examining data/sxid-4.20130802/src/sha2.h Examining data/sxid-4.20130802/src/sxid.c Examining data/sxid-4.20130802/src/getopt.c FINAL RESULTS: data/sxid-4.20130802/src/logging.c:259: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(p->path, p->mode)) data/sxid-4.20130802/src/conffile.c:100:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy((char*) config_options.mail_prog, MAIL_PROG); data/sxid-4.20130802/src/logging.c:74:11: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. temp += sprintf(temp, "%s", pw->pw_name); data/sxid-4.20130802/src/logging.c:83:11: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. temp += sprintf(temp, "%s", gr->gr_name); data/sxid-4.20130802/src/logging.c:104:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. temp += sprintf(temp, "%s->", pw->pw_name); data/sxid-4.20130802/src/logging.c:110:11: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. temp += sprintf(temp, "%s", pw->pw_name); data/sxid-4.20130802/src/logging.c:119:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. temp += sprintf(temp, "%s->", gr->gr_name); data/sxid-4.20130802/src/logging.c:125:11: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. temp += sprintf(temp, "%s", gr->gr_name); data/sxid-4.20130802/src/logging.c:387:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(tmp_file, tmp_dir); data/sxid-4.20130802/src/logging.c:479:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(p->hash_sum, hash_sum); data/sxid-4.20130802/src/logging.c:497:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(o, "%s%c%d", config_options.log_file, i == 0 ? data/sxid-4.20130802/src/logging.c:499:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(n, "%s.%d", config_options.log_file, i); data/sxid-4.20130802/src/notify.c:79:15: [4] (shell) popen: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. mail_pipe = popen(buffer, "w"); data/sxid-4.20130802/src/sxid.c:117:6: [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(confname, R_OK) != 0) { data/sxid-4.20130802/src/getopt.c:169:7: [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. char *getenv(); data/sxid-4.20130802/src/getopt.c:280: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. posixly_correct = getenv("POSIXLY_CORRECT"); data/sxid-4.20130802/src/getopt.c:607:5: [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. int getopt(argc, argv, optstring) data/sxid-4.20130802/src/getopt.h:106:12: [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. extern int getopt(int argc, char *const *argv, const char *shortopts); data/sxid-4.20130802/src/getopt.h:108:12: [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. extern int getopt(); data/sxid-4.20130802/src/getopt.h:110:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long(int argc, char *const *argv, const char *shortopts, data/sxid-4.20130802/src/getopt.h:122:12: [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. extern int getopt(); data/sxid-4.20130802/src/getopt.h:123:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long(); data/sxid-4.20130802/src/getopt1.c:50:7: [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. char *getenv(); data/sxid-4.20130802/src/getopt1.c:58:5: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt_long(argc, argv, options, long_options, opt_index) data/sxid-4.20130802/src/logging.c:378: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. tmp_dir = getenv("TMPDIR"); data/sxid-4.20130802/src/conffile.c:39: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[MAXBUF]; data/sxid-4.20130802/src/conffile.c:44:18: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((conffile = fopen(confname, "r")) == NULL) { data/sxid-4.20130802/src/conffile.c:92: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 value[MAXBUF]; data/sxid-4.20130802/src/conffile.c:96:2: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy((char*) config_options.email, "root"); data/sxid-4.20130802/src/conffile.c:121:29: [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). config_options.keep_logs = atoi(value); data/sxid-4.20130802/src/logging.c:72:11: [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. temp += sprintf(temp, "%d", (int)uid); data/sxid-4.20130802/src/logging.c:81:11: [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. temp += sprintf(temp, "%d", (int)gid); data/sxid-4.20130802/src/logging.c:102:12: [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. temp += sprintf(temp, "%d->", (int)p->old_uid); data/sxid-4.20130802/src/logging.c:108:11: [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. temp += sprintf(temp, "%d", (int)p->uid); data/sxid-4.20130802/src/logging.c:117:12: [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. temp += sprintf(temp, "%d->", (int)p->old_gid); data/sxid-4.20130802/src/logging.c:123:11: [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. temp += sprintf(temp, "%d", (int)p->gid); data/sxid-4.20130802/src/logging.c:175:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char old_pmode[7], *perms, *space1, *space2; data/sxid-4.20130802/src/logging.c:184:5: [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(old_pmode, "%o->", data/sxid-4.20130802/src/logging.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 buf[MAXBUF], *s, *tok, search_tok[2] = { 0x1e, '\0' }; data/sxid-4.20130802/src/logging.c:323: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). log = fopen(config_options.log_file, "r"); data/sxid-4.20130802/src/logging.c:353: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). p->uid = (uid_t)atoi(strtok(NULL, search_tok)); data/sxid-4.20130802/src/logging.c:354: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). p->gid = (gid_t)atoi(strtok(NULL, search_tok)); data/sxid-4.20130802/src/logging.c:355:21: [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). p->mode = (mode_t)atoi(strtok(NULL, search_tok)); data/sxid-4.20130802/src/logging.c:356:21: [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). p->inode = (ino_t)atoi(strtok(NULL, search_tok)); data/sxid-4.20130802/src/logging.c:388:2: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(tmp_file, "/sxid.XXXXXX"); data/sxid-4.20130802/src/logging.c:390:21: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). mail_file = fdopen(mkstemp(tmp_file), "w+b"); data/sxid-4.20130802/src/logging.c:495: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 o[PATH_MAX], n[PATH_MAX]; data/sxid-4.20130802/src/logging.c:504: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). new_log = fopen(config_options.log_file, "w"); data/sxid-4.20130802/src/notify.c:31: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 current_time[MAXBUF]; data/sxid-4.20130802/src/notify.c:35: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 hostname_val[MAXBUF]; data/sxid-4.20130802/src/notify.c:63: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[PATH_MAX + 64]; data/sxid-4.20130802/src/search.c:79: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[PATH_MAX]; data/sxid-4.20130802/src/search.c:103: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 digest[32 + 1]; data/sxid-4.20130802/src/search.c:105: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 digest_hex[(32 * 2) + 1], *p; data/sxid-4.20130802/src/search.c:114:11: [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. p += sprintf(p, "%02x", digest[i]); data/sxid-4.20130802/src/search.c:144: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 b[MAXBUF]; data/sxid-4.20130802/src/search.c:148: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 ((list = fopen(config_options.extra_list, "r")) == NULL) { data/sxid-4.20130802/src/sha2.c:103:54: [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. void sha2_process( sha2_context *ctx, const unsigned char data[64] ) data/sxid-4.20130802/src/sha2.c:256:9: [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( (void *) (ctx->buffer + left), input, fill ); data/sxid-4.20130802/src/sha2.c:271:9: [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( (void *) (ctx->buffer + left), input, ilen ); data/sxid-4.20130802/src/sha2.c:274:23: [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 const unsigned char sha2_padding[64] = data/sxid-4.20130802/src/sha2.c:285:47: [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. void sha2_finish( sha2_context *ctx, unsigned char output[32] ) data/sxid-4.20130802/src/sha2.c:289: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 msglen[8]; data/sxid-4.20130802/src/sha2.c:321:27: [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. void sha2( const unsigned char *input, size_t ilen, data/sxid-4.20130802/src/sha2.c:322:21: [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 output[32], int is224 ) data/sxid-4.20130802/src/sha2.c:337:22: [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. int sha2_file( const char *path, unsigned char output[32], int is224 ) data/sxid-4.20130802/src/sha2.c:337:43: [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. int sha2_file( const char *path, unsigned char output[32], int is224 ) data/sxid-4.20130802/src/sha2.c:342: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 buf[1024]; data/sxid-4.20130802/src/sha2.c:344: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( ( f = fopen( path, "rb" ) ) == NULL ) data/sxid-4.20130802/src/sha2.c:374: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 sum[32]; data/sxid-4.20130802/src/sha2.c:409:52: [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. void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] ) data/sxid-4.20130802/src/sha2.c:412: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 tmpbuf[32]; data/sxid-4.20130802/src/sha2.c:438:32: [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. void sha2_hmac( const unsigned char *key, size_t keylen, data/sxid-4.20130802/src/sha2.c:439:32: [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. const unsigned char *input, size_t ilen, data/sxid-4.20130802/src/sha2.c:440:26: [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 output[32], int is224 ) data/sxid-4.20130802/src/sha2.c:455: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. static unsigned char sha2_test_buf[3][57] = data/sxid-4.20130802/src/sha2.c:467:23: [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 const unsigned char sha2_test_sum[6][32] = data/sxid-4.20130802/src/sha2.c:505: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. static unsigned char sha2_hmac_test_key[7][26] = data/sxid-4.20130802/src/sha2.c:525: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. static unsigned char sha2_hmac_test_buf[7][153] = data/sxid-4.20130802/src/sha2.c:551:23: [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 const unsigned char sha2_hmac_test_sum[14][32] = data/sxid-4.20130802/src/sha2.c:620: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 buf[1024]; data/sxid-4.20130802/src/sha2.c:621: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 sha2sum[32]; data/sxid-4.20130802/src/sha2.h:52: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 buffer[64]; /*!< data block being processed */ data/sxid-4.20130802/src/sha2.h:54: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 ipad[64]; /*!< HMAC: inner padding */ data/sxid-4.20130802/src/sha2.h:55: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 opad[64]; /*!< HMAC: outer padding */ data/sxid-4.20130802/src/sha2.h:87:47: [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. void sha2_finish( sha2_context *ctx, unsigned char output[32] ); data/sxid-4.20130802/src/sha2.h:90:54: [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. void sha2_process( sha2_context *ctx, const unsigned char data[64] ); data/sxid-4.20130802/src/sha2.h:112:27: [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. void sha2( const unsigned char *input, size_t ilen, data/sxid-4.20130802/src/sha2.h:113:21: [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 output[32], int is224 ); data/sxid-4.20130802/src/sha2.h:124:22: [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. int sha2_file( const char *path, unsigned char output[32], int is224 ); data/sxid-4.20130802/src/sha2.h:124:43: [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. int sha2_file( const char *path, unsigned char output[32], int is224 ); data/sxid-4.20130802/src/sha2.h:152:52: [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. void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] ); data/sxid-4.20130802/src/sha2.h:171:32: [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. void sha2_hmac( const unsigned char *key, size_t keylen, data/sxid-4.20130802/src/sha2.h:172:32: [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. const unsigned char *input, size_t ilen, data/sxid-4.20130802/src/sha2.h:173:26: [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 output[32], int is224 ); data/sxid-4.20130802/src/sxid.h:61: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 search_paths[MAXBUF + 1]; data/sxid-4.20130802/src/sxid.h:62: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 exclude_paths[MAXBUF + 1]; data/sxid-4.20130802/src/sxid.h:63: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 ignore_dirs[MAXBUF + 1]; data/sxid-4.20130802/src/sxid.h:64: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 email[MAXBUF + 1]; data/sxid-4.20130802/src/sxid.h: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 log_file[MAXBUF + 1]; data/sxid-4.20130802/src/sxid.h:66: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 forbidden_paths[MAXBUF + 1]; data/sxid-4.20130802/src/sxid.h:67: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 mail_prog[MAXBUF + 1]; data/sxid-4.20130802/src/sxid.h:68: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 extra_list[MAXBUF + 1]; data/sxid-4.20130802/src/sxid.h: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. extern char current_time[MAXBUF]; data/sxid-4.20130802/src/conffile.c:61:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, strstr(buffer, "\"") + 1, MAXBUF); data/sxid-4.20130802/src/conffile.c:95:2: [1] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant character. strcpy((char*) config_options.exclude_paths, ""); data/sxid-4.20130802/src/conffile.c:97:2: [1] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant character. strcpy((char*) config_options.forbidden_paths, ""); data/sxid-4.20130802/src/conffile.c:98:2: [1] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant character. strcpy((char*) config_options.ignore_dirs, ""); data/sxid-4.20130802/src/getopt.c:192: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). extern int strlen(const char *); data/sxid-4.20130802/src/getopt.c:461: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 (nameend - nextchar == strlen(p->name)) { data/sxid-4.20130802/src/getopt.c:479: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). nextchar += strlen(nextchar); data/sxid-4.20130802/src/getopt.c:504:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen(nextchar); data/sxid-4.20130802/src/getopt.c:514:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen(nextchar); data/sxid-4.20130802/src/getopt.c:518: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). nextchar += strlen(nextchar); data/sxid-4.20130802/src/logging.c:147: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). space1 = fill_space(20 - strlen(perms)); data/sxid-4.20130802/src/logging.c:148: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). space2 = fill_space(32 - strlen(p->path) - data/sxid-4.20130802/src/logging.c:191: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). space1 = fill_space(20 - strlen(perms)); data/sxid-4.20130802/src/logging.c:192: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). space2 = fill_space(32 - strlen(p->path) - data/sxid-4.20130802/src/logging.c:224: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). space1 = fill_space(20 - strlen(perms)); data/sxid-4.20130802/src/logging.c:225: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). space2 = fill_space(32 - strlen(p->path) - data/sxid-4.20130802/src/logging.c:267: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). space1 = fill_space(20 - strlen(perms)); data/sxid-4.20130802/src/logging.c:268: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). space2 = fill_space(32 - strlen(p->path) - data/sxid-4.20130802/src/logging.c:298: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). space1 = fill_space(20 - strlen(perms)); data/sxid-4.20130802/src/logging.c:299: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). space2 = fill_space(32 - strlen(p->path) - data/sxid-4.20130802/src/logging.c:330: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). buf[strlen(buf) - 1] = '\0'; data/sxid-4.20130802/src/logging.c:337: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). s, strlen(config_options.search_paths))) data/sxid-4.20130802/src/logging.c:382:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). tmp_file = malloc(strlen(tmp_dir) + strlen("/sxid.XXXXXX") + 1); data/sxid-4.20130802/src/logging.c:382: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). tmp_file = malloc(strlen(tmp_dir) + strlen("/sxid.XXXXXX") + 1); data/sxid-4.20130802/src/search.c:86: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). strlen(dir) == 1 ? "" : "/", data/sxid-4.20130802/src/search.c:157: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 (b[strlen(b) - 1] == '\n') data/sxid-4.20130802/src/search.c:158: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). b[strlen(b) - 1] = '\0'; /* get rid of \n */ data/sxid-4.20130802/src/search.c:182: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). if (!strncmp(tok, dir, strlen(tok) - 1)) data/sxid-4.20130802/src/sxid.c:85:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(077); ANALYSIS SUMMARY: Hits = 133 Lines analyzed = 2983 in approximately 0.12 seconds (24516 lines/second) Physical Source Lines of Code (SLOC) = 1871 Hits@level = [0] 78 [1] 29 [2] 79 [3] 11 [4] 13 [5] 1 Hits@level+ = [0+] 211 [1+] 133 [2+] 104 [3+] 25 [4+] 14 [5+] 1 Hits/KSLOC@level+ = [0+] 112.774 [1+] 71.085 [2+] 55.5852 [3+] 13.3618 [4+] 7.48263 [5+] 0.534474 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.