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/bmf-0.9.4/bmf.c Examining data/bmf-0.9.4/lex.h Examining data/bmf-0.9.4/bmfconv.c Examining data/bmf-0.9.4/config.h Examining data/bmf-0.9.4/dbdb.h Examining data/bmf-0.9.4/dbg.c Examining data/bmf-0.9.4/dbg.h Examining data/bmf-0.9.4/dbh.c Examining data/bmf-0.9.4/dbh.h Examining data/bmf-0.9.4/dbmysql.c Examining data/bmf-0.9.4/dbmysql.h Examining data/bmf-0.9.4/dbtext.h Examining data/bmf-0.9.4/str.c Examining data/bmf-0.9.4/str.h Examining data/bmf-0.9.4/vec.c Examining data/bmf-0.9.4/vec.h Examining data/bmf-0.9.4/filt.c Examining data/bmf-0.9.4/filt.h Examining data/bmf-0.9.4/debian/patches/40-patch-lex.c Examining data/bmf-0.9.4/dbdb.c Examining data/bmf-0.9.4/dbtext.c Examining data/bmf-0.9.4/lex.c FINAL RESULTS: data/bmf-0.9.4/dbdb.c:114:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( pthis->dir, "%s/.bmf", phome ); data/bmf-0.9.4/dbdb.c:202:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( szpath, "%s/%s.db", pthis->dir, table ); data/bmf-0.9.4/dbdb.c:484: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 the scanf format is influenceable by an attacker, it's exploitable. if( sscanf( pbuf, BOGOFILTER_HEADER, &pthis->nmsgs ) != 1 ) data/bmf-0.9.4/dbdb.c:573:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. p += sprintf( p, BOGOFILTER_HEADER, pthis->nmsgs ); data/bmf-0.9.4/dbg.c:26:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf( str, sizeof(str)-1, fmt, v ); data/bmf-0.9.4/dbg.c:44: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( str, sizeof(str)-1, fmt, v ); data/bmf-0.9.4/dbmysql.c:110:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "SELECT count FROM %s WHERE name='%s'", data/bmf-0.9.4/dbmysql.c:162:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "UPDATE %s SET count=%u WHERE name='%s'", data/bmf-0.9.4/dbmysql.c:170:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "INSERT INTO %s ( name, count ) VALUES ( '%s', %u )", data/bmf-0.9.4/dbmysql.c:186:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "UPDATE %s SET count=count+%u WHERE name='%s'", data/bmf-0.9.4/dbmysql.c:194:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "INSERT INTO %s ( name, count ) VALUES ( '%s', %u )", data/bmf-0.9.4/dbmysql.c:238:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "UPDATE %s SET count=%u WHERE name='%s'", data/bmf-0.9.4/dbmysql.c:246:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "INSERT INTO %s ( name, count ) VALUES ( '%s', %u )", data/bmf-0.9.4/dbmysql.c:262:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "UPDATE %s SET count=GREATEST(0,count-%u) WHERE name='%s'", data/bmf-0.9.4/dbmysql.c:271:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "INSERT INTO %s ( name, count ) VALUES ( '%s', 0 )", data/bmf-0.9.4/dbmysql.c:332: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 the scanf format is influenceable by an attacker, it's exploitable. if( sscanf( pbuf, BOGOFILTER_HEADER, &pthis->nmsgs ) != 1 ) data/bmf-0.9.4/dbmysql.c:340:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "INSERT INTO %s ( name, count ) VALUES ( '%s', %u )", data/bmf-0.9.4/dbmysql.c:380:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "INSERT INTO %s ( name, count ) VALUES ( '%s', %u )", data/bmf-0.9.4/dbmysql.c:415:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. p += sprintf( p, BOGOFILTER_HEADER, pthis->nmsgs ); data/bmf-0.9.4/dbmysql.c:417:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "SELECT name, count FROM %s", data/bmf-0.9.4/dbmysql.c:435:14: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. p += sprintf( p, "%s %s\n", row[0], row[1] ); data/bmf-0.9.4/dbmysql.c:473:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( query, "SELECT count FROM %s WHERE name='%s'", data/bmf-0.9.4/dbtext.c:82:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( pthis->dir, "%s/.bmf", phome ); data/bmf-0.9.4/dbtext.c:167:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( szpath, "%s/%s.txt", pthis->dir, table ); data/bmf-0.9.4/dbtext.c:210: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 the scanf format is influenceable by an attacker, it's exploitable. if( sscanf( ptable->pbuf, BOGOFILTER_HEADER, &ptable->nmsgs ) != 1 ) data/bmf-0.9.4/dbtext.c:335:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. p += sprintf( p, BOGOFILTER_HEADER, pthis->nmsgs ); data/bmf-0.9.4/dbtext.c:434:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. p += sprintf( p, BOGOFILTER_HEADER, pthis->nmsgs ); data/bmf-0.9.4/bmf.c:96:5: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(time(NULL)); data/bmf-0.9.4/bmf.c:106:18: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while( (ch = getopt( argc, argv, "NSVd:f:i:hk:m:npstv" )) != EOF ) data/bmf-0.9.4/bmfconv.c:64:18: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while( (ch = getopt( argc, argv, "d:ef:ihv" )) != EOF ) data/bmf-0.9.4/dbdb.c:104:17: [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. phome = getenv( "HOME" ); data/bmf-0.9.4/dbtext.c:72:17: [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. phome = getenv( "HOME" ); data/bmf-0.9.4/bmf.c:149: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). stats.keepers = atoi( optarg ); data/bmf-0.9.4/bmf.c:189:14: [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( infile, O_RDONLY ); data/bmf-0.9.4/dbdb.c:147:22: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( pthis->envp->open( pthis->envp, pthis->dir, DB_INIT_LOCK|DB_INIT_MPOOL|DB_CREATE, 0644 ) != 0 ) data/bmf-0.9.4/dbdb.c:219:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( dbp->open( dbp, szpath, NULL, DB_BTREE, DB_CREATE, 0644 ) != 0 ) data/bmf-0.9.4/dbdb.c:229:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( dbp->open( dbp, NULL, szpath, NULL, DB_BTREE, DB_CREATE, 0644 ) != 0 ) data/bmf-0.9.4/dbdb.c:316: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 szword[MAXWORDLEN+1]; data/bmf-0.9.4/dbdb.c:380: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 szword[MAXWORDLEN+1]; data/bmf-0.9.4/dbdb.c:453: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 szword[MAXWORDLEN+1]; data/bmf-0.9.4/dbdb.c:459: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). if( (fd = open( filename, O_RDONLY, 0644 )) < 0 ) data/bmf-0.9.4/dbdb.c:552: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 iobuf[IOBUFSIZE]; data/bmf-0.9.4/dbdb.c:560: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). if( (fd = open( filename, O_CREAT|O_WRONLY|O_TRUNC, 0644 )) < 0 ) data/bmf-0.9.4/dbdb.c:583: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( p, key.data, key.size ); p += key.size; data/bmf-0.9.4/dbdb.c:585:18: [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, "%u\n", DBT2uint(&val) ); data/bmf-0.9.4/dbdb.c:617: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 szword[MAXWORDLEN+1]; data/bmf-0.9.4/dbdb.c:667:13: [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[MAXWORDLEN+32]; data/bmf-0.9.4/dbdb.c:675:13: [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( buf, "str: " ); data/bmf-0.9.4/dbdb.c:677: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( p, pstr->p, pstr->len ); data/bmf-0.9.4/dbdb.c:679: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( p, " %u", pstr->count ); data/bmf-0.9.4/dbg.c:23: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 str[4096]; data/bmf-0.9.4/dbg.c:41: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 str[4096]; data/bmf-0.9.4/dbg.c:106: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( pmem - sizeof(g_guard), g_guard, sizeof(g_guard) ); data/bmf-0.9.4/dbg.c:108: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( pmem + n, g_guard, sizeof(g_guard) ); data/bmf-0.9.4/dbg.c:228: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( pnew, p, pnode->len ); data/bmf-0.9.4/dbg.c:242:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( s2, s, sl ); data/bmf-0.9.4/dbg.c:255:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( s2, s, sl ); data/bmf-0.9.4/dbmysql.c:90: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 query[MAXQUERY]; data/bmf-0.9.4/dbmysql.c:122:25: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). ptable->nmsgs = atoi( row[0] ); data/bmf-0.9.4/dbmysql.c:146: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 szword[MAXWORDLEN+1]; data/bmf-0.9.4/dbmysql.c:147: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 szsqlword[MAXWORDLEN*2+1]; data/bmf-0.9.4/dbmysql.c:151: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 query[MAXQUERY]; data/bmf-0.9.4/dbmysql.c:219: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 szword[MAXWORDLEN+1]; data/bmf-0.9.4/dbmysql.c:220: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 szsqlword[MAXWORDLEN*2+1]; data/bmf-0.9.4/dbmysql.c:224: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 query[MAXQUERY]; data/bmf-0.9.4/dbmysql.c:302: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 szword[MAXWORDLEN+1]; data/bmf-0.9.4/dbmysql.c:303: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 szsqlword[MAXWORDLEN*2+1]; data/bmf-0.9.4/dbmysql.c:304: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 query[MAXQUERY]; data/bmf-0.9.4/dbmysql.c:310: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). if( (fd = open( filename, O_RDONLY, 0644 )) < 0 ) data/bmf-0.9.4/dbmysql.c:403: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 iobuf[IOBUFSIZE]; data/bmf-0.9.4/dbmysql.c:406: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 query[MAXQUERY]; data/bmf-0.9.4/dbmysql.c:410: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). if( (fd = open( filename, O_CREAT|O_WRONLY|O_TRUNC, 0644 )) < 0 ) data/bmf-0.9.4/dbmysql.c:462: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 szword[MAXWORDLEN+1]; data/bmf-0.9.4/dbmysql.c:463: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 szsqlword[MAXWORDLEN*2+1]; data/bmf-0.9.4/dbmysql.c:465: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 query[MAXQUERY]; data/bmf-0.9.4/dbmysql.c:485:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). count = atoi( row[0] ); data/bmf-0.9.4/dbmysql.c:522:13: [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[MAXWORDLEN+32]; data/bmf-0.9.4/dbmysql.c:530:13: [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( buf, "str: " ); data/bmf-0.9.4/dbmysql.c:532: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( p, pstr->p, pstr->len ); data/bmf-0.9.4/dbmysql.c:534: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( p, " %u", pstr->count ); data/bmf-0.9.4/dbtext.c:169:18: [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). ptable->fd = open( szpath, flags, 0644 ); data/bmf-0.9.4/dbtext.c:322: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 iobuf[IOBUFSIZE]; data/bmf-0.9.4/dbtext.c:362:18: [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, "%u\n", count ); data/bmf-0.9.4/dbtext.c:377:18: [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, "%u\n", count ); data/bmf-0.9.4/dbtext.c:391:18: [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, "%u\n", count ); data/bmf-0.9.4/dbtext.c:421: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 iobuf[IOBUFSIZE]; data/bmf-0.9.4/dbtext.c:461:18: [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, "%u\n", count ); data/bmf-0.9.4/dbtext.c:476:18: [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, "%u\n", count ); data/bmf-0.9.4/dbtext.c:491:18: [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, "%u\n", count ); data/bmf-0.9.4/dbtext.c:577:13: [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[MAXWORDLEN+32]; data/bmf-0.9.4/dbtext.c:585:13: [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( buf, "str: " ); data/bmf-0.9.4/dbtext.c:587: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( p, pstr->p, pstr->len ); data/bmf-0.9.4/dbtext.c:589: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( p, " %u", pstr->count ); data/bmf-0.9.4/debian/patches/40-patch-lex.c:10: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 szbuf[256]; data/bmf-0.9.4/filt.c:26: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 iobuf[IOBUFSIZE]; data/bmf-0.9.4/filt.c:31:10: [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( iobuf, "# Spamicity: %f\n", pstat->spamicity ); data/bmf-0.9.4/filt.c:37:13: [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( p, "# '" ); p += 3; data/bmf-0.9.4/lex.c:684: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 szbuf[256]; data/bmf-0.9.4/lex.c:693:9: [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( szbuf, "X-Spam-Status: Yes, hits=%f required=%f, tests=bmf\n" data/bmf-0.9.4/lex.c:699:9: [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( szbuf, "X-Spam-Status: No, hits=%f required=%f\n", data/bmf-0.9.4/lex.c:760:14: [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( argv[1], O_RDONLY ); data/bmf-0.9.4/lex.c:773: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 sztok[64]; data/bmf-0.9.4/lex.c:780: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( sztok, tok.p, tok.len ); data/bmf-0.9.4/vec.c:322:13: [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[256]; data/bmf-0.9.4/vec.c:330:13: [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( buf, "str: " ); data/bmf-0.9.4/vec.c:332: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( p, pstr->p, pstr->len ); data/bmf-0.9.4/vec.c:334: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( p, " %u", pstr->count ); data/bmf-0.9.4/dbdb.c:62: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). pdbt->size = strlen(p); data/bmf-0.9.4/dbdb.c:95: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). dirlen = strlen( dbname ); data/bmf-0.9.4/dbdb.c:109: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). pthis->dir = (char*)malloc( strlen(phome)+5+1 ); data/bmf-0.9.4/dbdb.c:197:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). szpath = malloc( strlen ( pthis->dir ) + strlen( table ) + 5 ); data/bmf-0.9.4/dbdb.c:197: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). szpath = malloc( strlen ( pthis->dir ) + strlen( table ) + 5 ); data/bmf-0.9.4/dbdb.c:476:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if( read( fd, pbuf, st.st_size ) != st.st_size ) data/bmf-0.9.4/dbg.c:239: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). uint sl = strlen(s); data/bmf-0.9.4/dbg.c:251: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). uint sl = strlen(s); data/bmf-0.9.4/dbmysql.c:327:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if( read( fd, pbuf, st.st_size ) != st.st_size ) data/bmf-0.9.4/dbtext.c:63: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). dirlen = strlen( dbname ); data/bmf-0.9.4/dbtext.c:77: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). pthis->dir = (char*)malloc( strlen(phome)+5+1 ); data/bmf-0.9.4/dbtext.c:162: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). szpath = malloc ( strlen( pthis->dir ) + strlen( table ) + 6 ); data/bmf-0.9.4/dbtext.c:162: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). szpath = malloc ( strlen( pthis->dir ) + strlen( table ) + 6 ); data/bmf-0.9.4/dbtext.c:203:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if( read( ptable->fd, ptable->pbuf, st.st_size ) != st.st_size ) data/bmf-0.9.4/lex.c:215: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). minlen = min( strlen(g_htmltags[mid]), len ); data/bmf-0.9.4/lex.c:222:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). minlen = min( strlen(g_htmltags[hi]), len ); data/bmf-0.9.4/lex.c:238: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). *ptoklen = strlen(g_htmltags[hi]); data/bmf-0.9.4/lex.c:391: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). minlen = min( strlen(g_ignoredheaders[mid]), len ); data/bmf-0.9.4/lex.c:398:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). minlen = min( strlen(g_ignoredheaders[hi]), len ); data/bmf-0.9.4/lex.c:508:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while( (nread = read( fd, pthis->pbuf + pthis->buflen, nalloc - pthis->buflen )) > 0 ) data/bmf-0.9.4/lex.c:739: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). write( STDOUT_FILENO, szbuf, strlen(szbuf) ); ANALYSIS SUMMARY: Hits = 128 Lines analyzed = 4657 in approximately 0.12 seconds (37339 lines/second) Physical Source Lines of Code (SLOC) = 3760 Hits@level = [0] 39 [1] 21 [2] 75 [3] 5 [4] 27 [5] 0 Hits@level+ = [0+] 167 [1+] 128 [2+] 107 [3+] 32 [4+] 27 [5+] 0 Hits/KSLOC@level+ = [0+] 44.4149 [1+] 34.0426 [2+] 28.4574 [3+] 8.51064 [4+] 7.18085 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.