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/surf-2.0+git20201107/arg.h Examining data/surf-2.0+git20201107/common.h Examining data/surf-2.0+git20201107/surf.c Examining data/surf-2.0+git20201107/webext-surf.c Examining data/surf-2.0+git20201107/config.def.h FINAL RESULTS: data/surf-2.0+git20201107/surf.c:314:8: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, errstr, ap); data/surf-2.0+git20201107/surf.c:1065:3: [4] (shell) execvp: 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. execvp(((char **)a->v)[0], (char **)a->v); data/surf-2.0+git20201107/surf.c:485: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. homedir = getenv("HOME"); data/surf-2.0+git20201107/surf.c:489:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. user = getenv("USER"); data/surf-2.0+git20201107/surf.c:514:10: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. fpath = realpath(apath, NULL); data/surf-2.0+git20201107/surf.c:579:36: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (!stat(apath, &st) && (path = realpath(apath, NULL))) { data/surf-2.0+git20201107/surf.c:244:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char winid[64]; data/surf-2.0+git20201107/surf.c:245:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char togglestats[12]; data/surf-2.0+git20201107/surf.c:246:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char pagestats[2]; data/surf-2.0+git20201107/surf.c:458: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). if (!(f = fopen(fpath, "a"))) data/surf-2.0+git20201107/surf.c:623: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. static char buf[BUFSIZ]; data/surf-2.0+git20201107/surf.c:696:12: [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. switch (((char *)curconfig[CookiePolicies].val.v)[cookiepolicy]) { data/surf-2.0+git20201107/surf.c:1005: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 tmp[64]; data/surf-2.0+git20201107/surf.c:1006: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. const char *cmd[29], *uri; data/surf-2.0+git20201107/surf.c:1243: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. static char msg[MSGBUFSZ]; data/surf-2.0+git20201107/surf.c:1877: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. static char msg[MSGBUFSZ]; data/surf-2.0+git20201107/webext-surf.c:24: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. static char msg[MSGBUFSZ]; data/surf-2.0+git20201107/webext-surf.c:41: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. static char js[48], msg[MSGBUFSZ]; data/surf-2.0+git20201107/surf.c:616: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). (unsigned char *)v, strlen(v) + 1); data/surf-2.0+git20201107/surf.c:633:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, (char *)p, LENGTH(buf) - 1); data/surf-2.0+git20201107/surf.c:1725: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). && strlen(uri) > 0) { data/surf-2.0+git20201107/surf.c:1726: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). for (i = 0; i < strlen(uri); i++) { data/surf-2.0+git20201107/surf.c:1942: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). cookiepolicy %= strlen(curconfig[CookiePolicies].val.v); data/surf-2.0+git20201107/webext-surf.c:25: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). size_t sln = strlen(s); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 2515 in approximately 0.08 seconds (31815 lines/second) Physical Source Lines of Code (SLOC) = 2105 Hits@level = [0] 21 [1] 6 [2] 12 [3] 4 [4] 2 [5] 0 Hits@level+ = [0+] 45 [1+] 24 [2+] 18 [3+] 6 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 21.3777 [1+] 11.4014 [2+] 8.55107 [3+] 2.85036 [4+] 0.950119 [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.