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/radioclk-1.0.pristine/refclock_shm.c Examining data/radioclk-1.0.pristine/radioclkd.c FINAL RESULTS: data/radioclk-1.0.pristine/refclock_shm.c:121:8: [5] (misc) SetSecurityDescriptorDacl: Never create NULL ACLs; an attacker can set it to Everyone (Deny All Access), which would even forbid administrator access (CWE-732). if (!SetSecurityDescriptorDacl(&sd,1,0,0)) { data/radioclk-1.0.pristine/refclock_shm.c:121:8: [5] (misc) SetSecurityDescriptorDacl: Never create NULL ACLs; an attacker can set it to Everyone (Deny All Access), which would even forbid administrator access (CWE-732). if (!SetSecurityDescriptorDacl(&sd,1,0,0)) { data/radioclk-1.0.pristine/radioclkd.c:121:10: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. #include<syslog.h> data/radioclk-1.0.pristine/radioclkd.c:904: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(stdout, USAGE_STRING); data/radioclk-1.0.pristine/radioclkd.c:907: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(stdout, VERSION_STRING); data/radioclk-1.0.pristine/radioclkd.c:948:7: [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(PID_FILE, R_OK)) { data/radioclk-1.0.pristine/radioclkd.c:162: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 line[4]; data/radioclk-1.0.pristine/radioclkd.c:163: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 code[128]; data/radioclk-1.0.pristine/radioclkd.c:896: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 devname[16] = "/dev/"; data/radioclk-1.0.pristine/radioclkd.c:926:16: [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 ((serial = open(devname, O_RDWR | O_NOCTTY | O_NDELAY))<0) { data/radioclk-1.0.pristine/radioclkd.c:949: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 ((str = fopen(PID_FILE, "r" ))) { data/radioclk-1.0.pristine/radioclkd.c:975: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 ((str=fopen(PID_FILE, "w"))) { data/radioclk-1.0.pristine/radioclkd.c:1032: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(dcd.line, "DCD"); data/radioclk-1.0.pristine/radioclkd.c:1033: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(cts.line, "CTS"); data/radioclk-1.0.pristine/radioclkd.c:1034: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(dsr.line, "DSR"); data/radioclk-1.0.pristine/refclock_shm.c:110: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[10]; data/radioclk-1.0.pristine/refclock_shm.c:115:2: [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 (buf,"NTP%d",unit); data/radioclk-1.0.pristine/refclock_shm.c:133: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 buf[1000]; data/radioclk-1.0.pristine/refclock_shm.c:143: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 buf[1000]; data/radioclk-1.0.pristine/refclock_shm.c:174:2: [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((char *)&pp->refid, REFID, 4); data/radioclk-1.0.pristine/radioclkd.c:533:4: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(5000); data/radioclk-1.0.pristine/radioclkd.c:916:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(devname, argv[i], 10); data/radioclk-1.0.pristine/radioclkd.c:920: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). if (strlen(devname)<6) { data/radioclk-1.0.pristine/radioclkd.c:1021:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 1366 in approximately 0.06 seconds (22734 lines/second) Physical Source Lines of Code (SLOC) = 890 Hits@level = [0] 23 [1] 4 [2] 14 [3] 0 [4] 4 [5] 2 Hits@level+ = [0+] 47 [1+] 24 [2+] 20 [3+] 6 [4+] 6 [5+] 2 Hits/KSLOC@level+ = [0+] 52.809 [1+] 26.9663 [2+] 22.4719 [3+] 6.74157 [4+] 6.74157 [5+] 2.24719 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.