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/xmotd-1.17.3b/patchlevel.h Examining data/xmotd-1.17.3b/changed.c Examining data/xmotd-1.17.3b/maindefs.h Examining data/xmotd-1.17.3b/appdefs.h Examining data/xmotd-1.17.3b/main.h Examining data/xmotd-1.17.3b/browser.c Examining data/xmotd-1.17.3b/logo.c Examining data/xmotd-1.17.3b/usage.c Examining data/xmotd-1.17.3b/atom.c Examining data/xmotd-1.17.3b/main.c Examining data/xmotd-1.17.3b/textmode.c Examining data/xmotd-1.17.3b/xmotd.c Examining data/xmotd-1.17.3b/prototypes.h FINAL RESULTS: data/xmotd-1.17.3b/atom.c:63:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "xmotd-%s.%s", atomname, pw->pw_name); data/xmotd-1.17.3b/browser.c:70:6: [4] (shell) execlp: 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. execlp(local_browser,local_browser,href,NULL); data/xmotd-1.17.3b/logo.c:70:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr,BAD_BITMAP_MESSAGE, logo); data/xmotd-1.17.3b/logo.c:101:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr,BAD_BITMAP_MESSAGE, logo); data/xmotd-1.17.3b/main.c:213:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s/%s", getenv("HOME"), app_res.stampfile); data/xmotd-1.17.3b/main.c:224:6: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(buf, domainame); data/xmotd-1.17.3b/main.c:373:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(newmsg->file, file); data/xmotd-1.17.3b/main.c:406:7: [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(name, argv[i]); data/xmotd-1.17.3b/main.c:410:7: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(name, dp->d_name); data/xmotd-1.17.3b/main.c:412:11: [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(name, 0) < 0) data/xmotd-1.17.3b/main.c:763:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(timeStamp, getTimeStampName()); data/xmotd-1.17.3b/textmode.c:60:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(stampfile, TIMESTAMP); /* default stampfile name */ data/xmotd-1.17.3b/textmode.c:64:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s/%s", getenv("HOME"), stampfile); data/xmotd-1.17.3b/textmode.c:114:7: [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(stampfile, (argv[i+1])); /* next param is the filename */ data/xmotd-1.17.3b/textmode.c:117:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s/%s", getenv("HOME"), stampfile); data/xmotd-1.17.3b/usage.c:42:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, USAGESTRING, str); data/xmotd-1.17.3b/xmotd.c:180:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "%s (%s)", ctime(&ftime), msgslist->file); data/xmotd-1.17.3b/xmotd.c:184:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "%s", ctime(&ftime)); data/xmotd-1.17.3b/main.c:213:25: [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. sprintf(buf, "%s/%s", getenv("HOME"), app_res.stampfile); data/xmotd-1.17.3b/textmode.c:64:26: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. sprintf(buf, "%s/%s", getenv("HOME"), stampfile); data/xmotd-1.17.3b/textmode.c:117:29: [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. sprintf(buf, "%s/%s", getenv("HOME"), stampfile); data/xmotd-1.17.3b/atom.c:59:10: [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 buffer[256]; data/xmotd-1.17.3b/main.c:140: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 timeStamp[256]; data/xmotd-1.17.3b/main.c:210:10: [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[256]; data/xmotd-1.17.3b/main.c:217: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 domainame[256]; data/xmotd-1.17.3b/main.c:272: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((fp=fopen(motdfile,"w"))==NULL){ data/xmotd-1.17.3b/main.c:396: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 name[BUFSIZ]; data/xmotd-1.17.3b/main.c:475:11: [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("/dev/console", O_RDONLY, O_RDONLY)<0)) data/xmotd-1.17.3b/textmode.c:56:10: [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[256], stampfile[256]; data/xmotd-1.17.3b/textmode.c:79:14: [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((fp=fopen(argv[i],"r"))==NULL) data/xmotd-1.17.3b/textmode.c:157:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if((fd=open("/dev/tty", O_RDONLY, O_RDONLY)<0)) data/xmotd-1.17.3b/xmotd.c:78: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 timeStamp[256]; data/xmotd-1.17.3b/xmotd.c:104:10: [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((fp=fopen(filename,"r"))==NULL) /* Read it in...*/ data/xmotd-1.17.3b/xmotd.c:158: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 buffer[256]; data/xmotd-1.17.3b/main.c:221:4: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(buf, "."); data/xmotd-1.17.3b/main.c:365: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). newmsg->file=(char *)calloc(1,(strlen(file)+1)*sizeof(char)); data/xmotd-1.17.3b/main.c:408: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). if (name[strlen(name) - 1] != '/') data/xmotd-1.17.3b/main.c:409:6: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(name, "/"); ANALYSIS SUMMARY: Hits = 38 Lines analyzed = 1855 in approximately 0.07 seconds (27981 lines/second) Physical Source Lines of Code (SLOC) = 1114 Hits@level = [0] 28 [1] 4 [2] 13 [3] 3 [4] 18 [5] 0 Hits@level+ = [0+] 66 [1+] 38 [2+] 34 [3+] 21 [4+] 18 [5+] 0 Hits/KSLOC@level+ = [0+] 59.246 [1+] 34.1113 [2+] 30.5206 [3+] 18.851 [4+] 16.158 [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.