This is interesting. It needs humans to review it, of course.
Flawfinder version 1.26, (C) 2001-2004 David A. Wheeler. Number of dangerous functions in C/C++ ruleset: 158 Examining spamc/qmail-spamc.c Examining spamc/libspamc.h Examining spamc/utils.c Examining spamc/spamc.c Examining spamc/utils.h Examining spamc/replace/getopt.c Examining spamc/replace/getopt.h Examining spamc/acconfig.h Examining spamc/version.h Examining spamc/libspamc.c Examining spamc/config.h Examining masses/perceptron.c spamc/libspamc.c:27: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate. Use a constant for the format specification. spamc/libspamc.c:27: [4] (format) _snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate. Use a constant for the format specification. spamc/libspamc.c:28: [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. Use a constant for the format specification. spamc/libspamc.c:866: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination. Consider using strncat or strlcat (warning, strncat is easily misused). spamc/libspamc.c:878: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination. Consider using strncat or strlcat (warning, strncat is easily misused). spamc/libspamc.c:1304: [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. Use a constant for the format specification. spamc/libspamc.c:1314: [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. Use a constant for the format specification. spamc/qmail-spamc.c:53: [4] (shell) execlp: This causes a new program to execute and is difficult to use safely. try using a library call that implements the same functionality if available. spamc/qmail-spamc.c:92: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely. try using a library call that implements the same functionality if available. spamc/qmail-spamc.c:98: [4] (shell) execlp: This causes a new program to execute and is difficult to use safely. try using a library call that implements the same functionality if available. spamc/spamc.c:376: [4] (shell) execv: This causes a new program to execute and is difficult to use safely. try using a library call that implements the same functionality if available. masses/perceptron.c:131: [3] (random) lrand48: This function is not sufficiently random for security-related functions such as key and nonce creation. use a more secure technique for acquiring random values. masses/perceptron.c:162: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation. use a more secure technique for acquiring random values. masses/perceptron.c:164: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation. use a more secure technique for acquiring random values. masses/perceptron.c:330: [3] (random) lrand48: This function is not sufficiently random for security-related functions such as key and nonce creation. use a more secure technique for acquiring random values. masses/perceptron.c:407: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows . Check implementation on installation, or limit the size of all string inputs. spamc/qmail-spamc.c:52: [3] (buffer) getenv: Environment variables are untrustable input if they can beit returns untrustable input if the environment can beset by an attacker. It can have any content and length, and the same variable can be set more than once. Check environment variables carefully before using them. spamc/qmail-spamc.c:60: [3] (buffer) getenv: Environment variables are untrustable input if they can beit returns untrustable input if the environment can beset by an attacker. It can have any content and length, and the same variable can be set more than once. Check environment variables carefully before using them. spamc/qmail-spamc.c:64: [3] (buffer) getenv: Environment variables are untrustable input if they can beit returns untrustable input if the environment can beset by an attacker. It can have any content and length, and the same variable can be set more than once. Check environment variables carefully before using them. spamc/qmail-spamc.c:68: [3] (buffer) getenv: Environment variables are untrustable input if they can beit returns untrustable input if the environment can beset by an attacker. It can have any content and length, and the same variable can be set more than once. Check environment variables carefully before using them. spamc/qmail-spamc.c:72: [3] (buffer) getenv: Environment variables are untrustable input if they can beit returns untrustable input if the environment can beset by an attacker. It can have any content and length, and the same variable can be set more than once. Check environment variables carefully before using them. spamc/qmail-spamc.c:75: [3] (buffer) getenv: Environment variables are untrustable input if they can beit returns untrustable input if the environment can beset by an attacker. It can have any content and length, and the same variable can be set more than once. Check environment variables carefully before using them. spamc/qmail-spamc.c:79: [3] (buffer) getenv: Environment variables are untrustable input if they can beit returns untrustable input if the environment can beset by an attacker. It can have any content and length, and the same variable can be set more than once. Check environment variables carefully before using them. spamc/replace/getopt.c:75: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows . Check implementation on installation, or limit the size of all string inputs. spamc/replace/getopt.c:168: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows . Check implementation on installation, or limit the size of all string inputs. spamc/replace/getopt.h:28: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows . Check implementation on installation, or limit the size of all string inputs. spamc/spamc.c:183: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows . Check implementation on installation, or limit the size of all string inputs. spamc/spamc.c:489: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation. use a more secure technique for acquiring random values. masses/perceptron.c:466: [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?. spamc/libspamc.c:576: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. spamc/libspamc.c:632: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. spamc/libspamc.c:754: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. spamc/libspamc.c:755: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. spamc/libspamc.c:783: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. spamc/libspamc.c:788: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. spamc/libspamc.c:810: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. spamc/libspamc.c:815: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. spamc/libspamc.c:848: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). Risk is low because the source is a constant string. spamc/libspamc.c:850: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). Risk is low because the source is a constant string. spamc/libspamc.c:852: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). Risk is low because the source is a constant string. spamc/libspamc.c:854: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). Risk is low because the source is a constant string. spamc/libspamc.c:856: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). Risk is low because the source is a constant string. spamc/libspamc.c:867: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination. Consider using strncat or strlcat (warning, strncat is easily misused). Risk is low because the source is a constant string. spamc/libspamc.c:877: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). Risk is low because the source is a constant string. spamc/libspamc.c:879: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination. Consider using strncat or strlcat (warning, strncat is easily misused). Risk is low because the source is a constant string. spamc/libspamc.c:888: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. spamc/libspamc.c:1258: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. spamc/libspamc.c:1296: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. spamc/libspamc.c:1340: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. spamc/libspamc.c:1344: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. spamc/libspamc.c:1351: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. spamc/libspamc.c:1352: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. spamc/qmail-spamc.c:39: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. spamc/libspamc.c:304: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers. spamc/libspamc.c:764: [1] (buffer) sscanf: it's unclear if the %s limit in the format string is small enough. Check that the limit is sufficiently small, or use a different input function. spamc/libspamc.c:858: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). spamc/libspamc.c:859: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). spamc/libspamc.c:868: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). spamc/libspamc.c:871: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). spamc/libspamc.c:880: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). spamc/libspamc.c:932: [1] (buffer) sscanf: it's unclear if the %s limit in the format string is small enough. Check that the limit is sufficiently small, or use a different input function. spamc/libspamc.c:1303: [1] (port) snprintf: On some very old systems, snprintf is incorrectly implemented and permits buffer overflows; there are also incompatible standard definitions of it. Check it during installation, or use something else. spamc/libspamc.c:1309: [1] (port) snprintf: On some very old systems, snprintf is incorrectly implemented and permits buffer overflows; there are also incompatible standard definitions of it. Check it during installation, or use something else. spamc/utils.c:86: [1] (buffer) read: Check buffer boundaries if used in a loop.
Hits = 64 Lines analyzed = 3536 in 1.08 seconds (6072 lines/second) Physical Source Lines of Code (SLOC) = 2367 [EMAIL PROTECTED] = [0] 0 [1] 11 [2] 25 [3] 17 [4] 11 [5] 0 [EMAIL PROTECTED] = [0+] 64 [1+] 64 [2+] 53 [3+] 28 [4+] 11 [5+] 0 Hits/[EMAIL PROTECTED] = [0+] 27.0384 [1+] 27.0384 [2+] 22.3912 [3+] 11.8293 [4+] 4.64723 [5+] 0 Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code!
-- Daniel Quinlan http://www.pathname.com/~quinlan/
