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/libosmosdr-0.1.8.effcaa7/src/osmo_sdr.c Examining data/libosmosdr-0.1.8.effcaa7/src/libosmosdr.c Examining data/libosmosdr-0.1.8.effcaa7/include/osmosdr.h Examining data/libosmosdr-0.1.8.effcaa7/include/osmosdr_export.h FINAL RESULTS: data/libosmosdr-0.1.8.effcaa7/src/osmo_sdr.c:116: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 ((opt = getopt(argc, argv, "d:f:g:s:b:S::")) != -1) { data/libosmosdr-0.1.8.effcaa7/src/libosmosdr.c:326:4: [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(gains, e4k_gains, len); data/libosmosdr-0.1.8.effcaa7/src/osmo_sdr.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 vendor[256] = { 0 }, product[256] = { 0 }, serial[256] = { 0 }; data/libosmosdr-0.1.8.effcaa7/src/osmo_sdr.c:119:16: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). dev_index = atoi(optarg); data/libosmosdr-0.1.8.effcaa7/src/osmo_sdr.c:150:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). dev_index = atoi(argv[1]); data/libosmosdr-0.1.8.effcaa7/src/osmo_sdr.c:151:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). samp_rate = atoi(argv[2])*1000; data/libosmosdr-0.1.8.effcaa7/src/osmo_sdr.c:153:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). frequency = atoi(argv[4]); data/libosmosdr-0.1.8.effcaa7/src/osmo_sdr.c:261: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). file = fopen(filename, "wb"); data/libosmosdr-0.1.8.effcaa7/src/libosmosdr.c:33:9: [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. #define usleep(t) Sleep((t)/1000) data/libosmosdr-0.1.8.effcaa7/src/libosmosdr.c:778:3: [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(10); ANALYSIS SUMMARY: Hits = 10 Lines analyzed = 1565 in approximately 0.11 seconds (14413 lines/second) Physical Source Lines of Code (SLOC) = 1048 Hits@level = [0] 41 [1] 2 [2] 7 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 51 [1+] 10 [2+] 8 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 48.6641 [1+] 9.54198 [2+] 7.63359 [3+] 0.954198 [4+] 0 [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.