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/linssid-3.6/linssid-app/MainForm.cpp Examining data/linssid-3.6/linssid-app/prefsDialog.h Examining data/linssid-3.6/linssid-app/AboutBox.cpp Examining data/linssid-3.6/linssid-app/Custom.h Examining data/linssid-3.6/linssid-app/Getter.cpp Examining data/linssid-3.6/linssid-app/AboutBox.h Examining data/linssid-3.6/linssid-app/Getter.h Examining data/linssid-3.6/linssid-app/main.cpp Examining data/linssid-3.6/linssid-app/prefsDialog.cpp Examining data/linssid-3.6/linssid-app/MainForm.h FINAL RESULTS: data/linssid-3.6/linssid-app/MainForm.cpp:506:11: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. waste(chown(fullPrefsNameCstr, realUser->pw_uid, realUser->pw_gid)); data/linssid-3.6/linssid-app/MainForm.cpp:507:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(fullPrefsNameCstr, 00644); data/linssid-3.6/linssid-app/MainForm.cpp:552:11: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. waste(chown(fullPrefsNameCstr, realUser->pw_uid, realUser->pw_gid)); data/linssid-3.6/linssid-app/MainForm.cpp:553:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(fullPrefsNameCstr, 00644); data/linssid-3.6/linssid-app/MainForm.cpp:1287:23: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. waste(chown(fullLogNameCstr, realUser->pw_uid, realUser->pw_gid)); data/linssid-3.6/linssid-app/MainForm.cpp:1288:17: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(fullLogNameCstr, 00644); data/linssid-3.6/linssid-app/MainForm.cpp:1327:11: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. waste(chown(fullLogNameCstr, realUser->pw_uid, realUser->pw_gid)); data/linssid-3.6/linssid-app/MainForm.cpp:1328:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(fullLogNameCstr, 00644); data/linssid-3.6/linssid-app/Getter.cpp:94:25: [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. rcSysCall = system(lineCommand.c_str()); data/linssid-3.6/linssid-app/Getter.cpp:106: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. waste(system(endCommand.c_str())); // put the end block tag in the stream data/linssid-3.6/linssid-app/MainForm.cpp:392:9: [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 (system(commandLine.c_str()) == 0) { data/linssid-3.6/linssid-app/MainForm.cpp:394: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. waste(system(commandLine.c_str())); data/linssid-3.6/linssid-app/MainForm.cpp:413:9: [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 (system(commandLine.c_str()) == 0) { data/linssid-3.6/linssid-app/MainForm.cpp:415: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. waste(system(commandLine.c_str())); data/linssid-3.6/linssid-app/MainForm.cpp:274:5: [3] (random) srand: 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. srand(time(NULL)); //initialize the random number generator seed data/linssid-3.6/linssid-app/main.cpp:61: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. if (getenv("PKEXEC_UID") != nullptr) { data/linssid-3.6/linssid-app/main.cpp:62:24: [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. realUID = atoi(getenv("PKEXEC_UID")); data/linssid-3.6/linssid-app/main.cpp:97:5: [3] (random) srand: 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. srand(time(NULL)); data/linssid-3.6/linssid-app/MainForm.cpp:345: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). vendorFile.open(VENDOR_FILE_NAME, ios::in); data/linssid-3.6/linssid-app/MainForm.cpp:505: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). prefs.open(fullPrefsName, ios::out); data/linssid-3.6/linssid-app/MainForm.cpp:551: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). prefs.open(fullPrefsName, ios::out); data/linssid-3.6/linssid-app/MainForm.cpp:592: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). prefs.open(fullPrefsName, ios::in); data/linssid-3.6/linssid-app/MainForm.cpp:595:15: [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). prefs.open(fullPrefsName, ios::in); data/linssid-3.6/linssid-app/MainForm.cpp:612:15: [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). prefs.open(fullPrefsName, ios::in); data/linssid-3.6/linssid-app/MainForm.cpp:1188:46: [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). MainForm::cellDataRay[tbi].channel = atoi(tempChan.c_str()); data/linssid-3.6/linssid-app/MainForm.cpp:1194:46: [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). MainForm::cellDataRay[tbi].channel = atoi(tempChan.c_str()); data/linssid-3.6/linssid-app/MainForm.cpp:1209:49: [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). MainForm::cellDataRay[tbi].signal = atoi(tempSig.c_str()); data/linssid-3.6/linssid-app/MainForm.cpp:1243:41: [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). MainForm::cellDataRay[tbi].BW = atoi(tempString.c_str()); data/linssid-3.6/linssid-app/MainForm.cpp:1276:33: [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). MainForm::logDataStream.open(fullLogName, ios::in); // open for read to see if file already exists data/linssid-3.6/linssid-app/MainForm.cpp:1286:41: [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). MainForm::logDataStream.open(fullLogName, ios::out | ios::app); data/linssid-3.6/linssid-app/MainForm.cpp:1295: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 nowStr[64], firstStr[64], lastStr[64]; data/linssid-3.6/linssid-app/MainForm.cpp:1326:29: [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). MainForm::logDataStream.open(fullLogName, ios::out | ios::app); // open for write append data/linssid-3.6/linssid-app/MainForm.cpp:1360:21: [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). block = atoi(tempLine.substr(endBlockString.length() + 1, std::string::npos).c_str()); data/linssid-3.6/linssid-app/MainForm.cpp:1395:19: [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). tempInt = atoi(item.c_str()); data/linssid-3.6/linssid-app/MainForm.cpp:1408:19: [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). tempInt = atoi(item.c_str()); data/linssid-3.6/linssid-app/main.cpp:62:19: [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). realUID = atoi(getenv("PKEXEC_UID")); data/linssid-3.6/linssid-app/MainForm.cpp:726:37: [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. while (runState != STOPPED) usleep(500 * 1000); // wait half a second and try again data/linssid-3.6/linssid-app/MainForm.cpp:798:33: [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. while (runState != STOPPED) usleep(500 * 1000); // wait until getter is stopped ANALYSIS SUMMARY: Hits = 38 Lines analyzed = 2054 in approximately 0.54 seconds (3837 lines/second) Physical Source Lines of Code (SLOC) = 1667 Hits@level = [0] 0 [1] 2 [2] 18 [3] 4 [4] 6 [5] 8 Hits@level+ = [0+] 38 [1+] 38 [2+] 36 [3+] 18 [4+] 14 [5+] 8 Hits/KSLOC@level+ = [0+] 22.7954 [1+] 22.7954 [2+] 21.5957 [3+] 10.7978 [4+] 8.39832 [5+] 4.79904 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.