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/psk31lx-2.2/src/coeff.h Examining data/psk31lx-2.2/src/modes/psk31-transmitter.C Examining data/psk31lx-2.2/src/modes/psk31-receiver.h Examining data/psk31lx-2.2/src/modes/psk31-fft.h Examining data/psk31lx-2.2/src/modes/psk31-coder.C Examining data/psk31lx-2.2/src/modes/psk31-transmitter.h Examining data/psk31lx-2.2/src/modes/psk31-coder.h Examining data/psk31lx-2.2/src/modes/hansis_fft.h Examining data/psk31lx-2.2/src/modes/psk31-fft.C Examining data/psk31lx-2.2/src/modes/psk31-receiver.C Examining data/psk31lx-2.2/src/modes/hansis_fft.C Examining data/psk31lx-2.2/src/server/server.h Examining data/psk31lx-2.2/src/server/server.C Examining data/psk31lx-2.2/src/term-psk31.C FINAL RESULTS: data/psk31lx-2.2/src/term-psk31.C:302:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf, " %4s/%3s DCD:%3s RX=%6.1f AFC:%3s TX=%6.1f NET:%3s" " %2s\n", data/psk31lx-2.2/src/term-psk31.C:404:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf, " F1: %-15s F2: %-15s", macro[0], macro[1]); data/psk31lx-2.2/src/term-psk31.C:407:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf, " F3: %-15s F4: %-15s", macro[2], macro[3]); data/psk31lx-2.2/src/term-psk31.C:410:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf, " F5: %-15s F6: %-15s", macro[4], macro[5]); data/psk31lx-2.2/src/term-psk31.C:413:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf, " F7: %-15s F8: %-15s", macro[6], macro[7]); data/psk31lx-2.2/src/term-psk31.C:416:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf, " F9: %-15s F10:%-15s", macro[8], macro[9]); data/psk31lx-2.2/src/term-psk31.C:495:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (PACKAGE_STRING "\n"); data/psk31lx-2.2/src/term-psk31.C:521:15: [4] (shell) system: 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. if ((res = system ("resize -s 30 80")) != 0) data/psk31lx-2.2/src/term-psk31.C:700:16: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buffer, " de %s", callsign); data/psk31lx-2.2/src/modes/psk31-coder.C:186:14: [3] (random) random: 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. return random() / (RAND_MAX >> 1); data/psk31lx-2.2/src/modes/psk31-coder.C:248:13: [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. ptr = getenv ("HOME"); data/psk31lx-2.2/src/term-psk31.C:165:10: [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. ptr = getenv ("HOME"); data/psk31lx-2.2/src/term-psk31.C:487:16: [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 ((c = getopt (argc, argv, "t:vqlxh")) != -1) data/psk31lx-2.2/src/term-psk31.C:518:4: [3] (random) srandom: 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. srandom (time ((time_t *) 0)); data/psk31lx-2.2/src/modes/psk31-coder.C:15: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. unsigned char distance[4][4] = data/psk31lx-2.2/src/modes/psk31-coder.C:240: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[15], codfile[1024], *ptr; data/psk31lx-2.2/src/modes/psk31-coder.C:244:4: [2] (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 string. strcat (codfile, "psk31.cod"); data/psk31lx-2.2/src/modes/psk31-coder.C:245:9: [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). fp = fopen (codfile, "r"); data/psk31lx-2.2/src/modes/psk31-coder.C:252:10: [2] (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 string. strcat (codfile, "/psk31.cod"); data/psk31lx-2.2/src/modes/psk31-coder.C:253:15: [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). fp = fopen (codfile, "r"); data/psk31lx-2.2/src/modes/psk31-coder.C:257: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). fp = fopen ("psk31.cod", "r"); data/psk31lx-2.2/src/modes/psk31-coder.h:61:20: [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 unsigned char symbols[32]; data/psk31lx-2.2/src/server/server.C:143:4: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy (data, b->mem + b->wpos, n); data/psk31lx-2.2/src/server/server.C:148:7: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy( data + n, b->mem, cnt); data/psk31lx-2.2/src/server/server.C:180:4: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy (b->mem + b->rpos, data, n); data/psk31lx-2.2/src/server/server.C:185:7: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy (b->mem, data + n, cnt); data/psk31lx-2.2/src/server/server.C:245: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). pttfd = open (ptt_path, O_RDWR); data/psk31lx-2.2/src/term-psk31.C:57: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 ptt_path[32] = "/dev/ttyS1"; data/psk31lx-2.2/src/term-psk31.C:69: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 callsign[40] = "NOCALL"; /* User's callsign */ data/psk31lx-2.2/src/term-psk31.C:77: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 macro[10][40]; data/psk31lx-2.2/src/term-psk31.C:155: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 homecfgfile[256], cfgfile[256], buf[80], *ptr; data/psk31lx-2.2/src/term-psk31.C:170:7: [2] (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 string. strcat (homecfgfile, "/.psk31lx.ini"); data/psk31lx-2.2/src/term-psk31.C:171: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). fp = fopen (homecfgfile, "r"); data/psk31lx-2.2/src/term-psk31.C:183:7: [2] (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 string. strcat (cfgfile, "psk31lx.ini"); data/psk31lx-2.2/src/term-psk31.C:185: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). fp = fopen (cfgfile, "r"); data/psk31lx-2.2/src/term-psk31.C:189:22: [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 ((fpcp = fopen (homecfgfile, "w")) == NULL) data/psk31lx-2.2/src/term-psk31.C:212: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). fp = fopen (cfgfile, "r"); data/psk31lx-2.2/src/term-psk31.C:289: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[128]; data/psk31lx-2.2/src/term-psk31.C:326: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 wfout[22]; data/psk31lx-2.2/src/term-psk31.C:401: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[128]; data/psk31lx-2.2/src/term-psk31.C:479: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[256], buffer[128]; data/psk31lx-2.2/src/modes/psk31-coder.C:242:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (codfile, datadir, 1000); data/psk31lx-2.2/src/modes/psk31-coder.C:243: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 (codfile[strlen (codfile)-1] != ' ') strcat (codfile, "/"); data/psk31lx-2.2/src/modes/psk31-coder.C:243:44: [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. if (codfile[strlen (codfile)-1] != ' ') strcat (codfile, "/"); data/psk31lx-2.2/src/modes/psk31-coder.C:251:10: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (codfile, ptr, 1000); data/psk31lx-2.2/src/modes/psk31-coder.C:271:11: [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). n = strlen (buf); data/psk31lx-2.2/src/modes/psk31-transmitter.C:168:58: [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 (bufferspace() < (sendchar_cwmode ? 5 : 1) * (int) strlen (str) + 100) data/psk31lx-2.2/src/modes/psk31-transmitter.C:194:35: [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 (bufferspace () < 5 * (int) strlen (str)) data/psk31lx-2.2/src/modes/psk31-transmitter.C:513:7: [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 (100); /* avoid high cpu xmit usage */ data/psk31lx-2.2/src/server/server.C:360:13: [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 (100); /* give it some time */ data/psk31lx-2.2/src/server/server.C:436:17: [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). int len = strlen (ptt_path); data/psk31lx-2.2/src/server/server.C:527: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). buflen = strlen (buffer); data/psk31lx-2.2/src/term-psk31.C:169:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (homecfgfile, ptr, 256); data/psk31lx-2.2/src/term-psk31.C:176:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (cfgfile, PKG_DATA_DIR, 256); data/psk31lx-2.2/src/term-psk31.C:178: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). if (cfgfile[strlen (cfgfile) - 1] != '/') data/psk31lx-2.2/src/term-psk31.C:180:10: [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 (cfgfile, "/"); data/psk31lx-2.2/src/term-psk31.C:211:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy (cfgfile, "./psk31lx.ini", 256); data/psk31lx-2.2/src/term-psk31.C:492:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (ptt_path, optarg, 20); ANALYSIS SUMMARY: Hits = 58 Lines analyzed = 5023 in approximately 0.14 seconds (34809 lines/second) Physical Source Lines of Code (SLOC) = 3922 Hits@level = [0] 66 [1] 17 [2] 27 [3] 5 [4] 9 [5] 0 Hits@level+ = [0+] 124 [1+] 58 [2+] 41 [3+] 14 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 31.6165 [1+] 14.7884 [2+] 10.4539 [3+] 3.56961 [4+] 2.29475 [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.