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/wm2-4+svn20090216/listmacro2.h Examining data/wm2-4+svn20090216/Main.C Examining data/wm2-4+svn20090216/Client.h Examining data/wm2-4+svn20090216/Client.C Examining data/wm2-4+svn20090216/Events.C Examining data/wm2-4+svn20090216/Buttons.C Examining data/wm2-4+svn20090216/Border.C Examining data/wm2-4+svn20090216/Border.h Examining data/wm2-4+svn20090216/Cursors.h Examining data/wm2-4+svn20090216/Manager.C Examining data/wm2-4+svn20090216/Manager.h Examining data/wm2-4+svn20090216/Rotated.C Examining data/wm2-4+svn20090216/Rotated.h Examining data/wm2-4+svn20090216/Config.h Examining data/wm2-4+svn20090216/General.h FINAL RESULTS: data/wm2-4+svn20090216/General.h:32:23: [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). #define NewString(x) (strcpy((char *)malloc(strlen(x)+1),(x))) data/wm2-4+svn20090216/Manager.C:324:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error, "couldn't load %s colour", desc); data/wm2-4+svn20090216/Manager.C:549:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(pstring, "DISPLAY=%s", displayName); data/wm2-4+svn20090216/Manager.C:554:3: [4] (shell) execl: 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. execl(m_shell, m_shell, "-c", CONFIG_NEW_WINDOW_COMMAND, (char*)0); data/wm2-4+svn20090216/Manager.C:559: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(CONFIG_NEW_WINDOW_COMMAND, CONFIG_NEW_WINDOW_COMMAND, (char*)0); data/wm2-4+svn20090216/Manager.C:563: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("xterm", "xterm", "-ut", (char*)0); data/wm2-4+svn20090216/Rotated.C:53: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(s, str); data/wm2-4+svn20090216/Manager.C:78:23: [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. m_shell = (char *)getenv("SHELL"); data/wm2-4+svn20090216/Border.C:196: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(newLabel + len - 1, "..."); data/wm2-4+svn20090216/Buttons.C:329: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 string[20]; data/wm2-4+svn20090216/Buttons.C:330:5: [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(string, "%d %d\n", x, y); data/wm2-4+svn20090216/Manager.C:192: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 msg[100], number[30], request[100]; data/wm2-4+svn20090216/Manager.C:194:5: [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(number, "%d", e->request_code); data/wm2-4+svn20090216/Manager.C:197:29: [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. if (request[0] == '\0') sprintf(request, "<request-code-%d>", data/wm2-4+svn20090216/Manager.C:323: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 error[100]; data/wm2-4+svn20090216/Rotated.C:132: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 text[3];/*, errstr[300];*/ data/wm2-4+svn20090216/Rotated.C:231:7: [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(text, "%c", ichar); data/wm2-4+svn20090216/listmacro2.h:60:5: [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(m_items+index, m_items+index+1, (m_count-index-1) * sizeof(T)); \ data/wm2-4+svn20090216/listmacro2.h:72:20: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. if (index > 0) memcpy(m_items+1, m_items, index * sizeof(T)); \ data/wm2-4+svn20090216/Border.C:152: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). m_label, strlen(m_label)); data/wm2-4+svn20090216/Border.C:179:40: [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). XRotTextWidth(m_tabFont, m_label, strlen(m_label)) + 6 + m_tabWidth; data/wm2-4+svn20090216/Border.C:188:15: [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(m_label); data/wm2-4+svn20090216/Border.C:195:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(newLabel, m_label, len - 1); data/wm2-4+svn20090216/Border.C:198:9: [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). strlen(newLabel)) + 6 + m_tabWidth; data/wm2-4+svn20090216/Buttons.C:164:48: [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). width = XTextWidth(m_menuFont, MENU_LABEL(i), strlen(MENU_LABEL(i))); data/wm2-4+svn20090216/Buttons.C:279:9: [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). strlen(MENU_LABEL(i))); data/wm2-4+svn20090216/Buttons.C:285:20: [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). MENU_LABEL(i), strlen(MENU_LABEL(i))); data/wm2-4+svn20090216/Buttons.C:288:24: [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). dy, MENU_LABEL(i), strlen(MENU_LABEL(i))); data/wm2-4+svn20090216/Buttons.C:331:48: [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 width = XTextWidth(m_menuFont, string, strlen(string)) + 8; data/wm2-4+svn20090216/Buttons.C:342: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). string, strlen(string)); data/wm2-4+svn20090216/General.h:32:45: [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). #define NewString(x) (strcpy((char *)malloc(strlen(x)+1),(x))) data/wm2-4+svn20090216/Main.C:12: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). for (i = strlen(argv[0])-1; i > 0 && argv[0][i] != '/'; --i); data/wm2-4+svn20090216/Manager.C:548: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). char *pstring = (char *)malloc(strlen(displayName) + 10); data/wm2-4+svn20090216/Rotated.C:46:33: [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). s = (char *)malloc((unsigned)(strlen(str)+1)); data/wm2-4+svn20090216/Rotated.C:82: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). len = strlen(str1); data/wm2-4+svn20090216/Rotated.C:93:21: [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). for (j = 0; j < strlen(str2); j++) data/wm2-4+svn20090216/Rotated.C:114:20: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). if (str != NULL) strncpy(str, XV_COPYRIGHT, n); data/wm2-4+svn20090216/Rotated.C:374:51: [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). width = XTextWidth(rotfont->xfontstruct, str, strlen(str)); data/wm2-4+svn20090216/Rotated.C:482: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). for (i = 0; i<strlen(text); i++) data/wm2-4+svn20090216/Rotated.C:489:44: [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). max_width = XRotTextWidth(rotfont, str3, strlen(str3)); data/wm2-4+svn20090216/Rotated.C:494:40: [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 (XRotTextWidth(rotfont, str3, strlen(str3))>max_width) data/wm2-4+svn20090216/Rotated.C:495:43: [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). max_width = XRotTextWidth(rotfont, str3, strlen(str3)); data/wm2-4+svn20090216/Rotated.C:556:47: [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). this_width = XRotTextWidth(rotfont, str3, strlen(str3)); data/wm2-4+svn20090216/Rotated.C:605:12: [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). str3, strlen(str3)); ANALYSIS SUMMARY: Hits = 44 Lines analyzed = 4857 in approximately 0.12 seconds (41158 lines/second) Physical Source Lines of Code (SLOC) = 3464 Hits@level = [0] 45 [1] 25 [2] 11 [3] 1 [4] 7 [5] 0 Hits@level+ = [0+] 89 [1+] 44 [2+] 19 [3+] 8 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 25.6928 [1+] 12.7021 [2+] 5.48499 [3+] 2.30947 [4+] 2.02079 [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.