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/lwm-1.2.2/shape.c Examining data/lwm-1.2.2/ewmh.c Examining data/lwm-1.2.2/resource.c Examining data/lwm-1.2.2/client.c Examining data/lwm-1.2.2/cursor.c Examining data/lwm-1.2.2/ewmh.h Examining data/lwm-1.2.2/mouse.c Examining data/lwm-1.2.2/manage.c Examining data/lwm-1.2.2/session.c Examining data/lwm-1.2.2/error.c Examining data/lwm-1.2.2/lwm.h Examining data/lwm-1.2.2/lwm.c Examining data/lwm-1.2.2/disp.c FINAL RESULTS: data/lwm-1.2.2/client.c:799:3: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(&c->menu_name[(strlen(c->name) / 2) - cut], dots); data/lwm-1.2.2/client.c:800:3: [4] (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). strcat(c->menu_name, data/lwm-1.2.2/lwm.c:299: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(sh, sh, "-c", command, NULL); data/lwm-1.2.2/lwm.c:302:3: [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("x-terminal-emulator", "x-terminal-emulator", NULL); data/lwm-1.2.2/lwm.c:394:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(screens[screen].display_spec, "DISPLAY=%s", display_string); data/lwm-1.2.2/resource.c:50:9: [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). return strcpy(s, p); data/lwm-1.2.2/lwm.c:290:7: [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. sh = getenv("SHELL"); data/lwm-1.2.2/client.c:434: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[4*2 + 3 + 1]; data/lwm-1.2.2/client.c:458: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[4*2 + 3 + 1]; data/lwm-1.2.2/client.c:685: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(&c->return_size, &c->size, sizeof(XSizeHints)); data/lwm-1.2.2/client.c:718: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(&c->size, &c->return_size, sizeof(XSizeHints)); data/lwm-1.2.2/error.c:40: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 msg[80]; data/lwm-1.2.2/error.c:41: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 req[80]; data/lwm-1.2.2/error.c:42: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 number[80]; data/lwm-1.2.2/error.c:54: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(number, "%d", e->request_code); data/lwm-1.2.2/lwm.c:397:3: [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(dot, ".%i", screen); data/lwm-1.2.2/session.c:83: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 pid_s[32]; data/lwm-1.2.2/session.c:188: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 err[256]; data/lwm-1.2.2/client.c:439:32: [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). popup_width = popupWidth(buf, strlen(buf)); data/lwm-1.2.2/client.c:483: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). (popup_width - popupWidth(buf, strlen(buf))) / 2, data/lwm-1.2.2/client.c:484: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). ascent(popup_font_set_ext) + 1, buf, strlen(buf)); data/lwm-1.2.2/client.c:778: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). c->namelen = strlen(c->name); data/lwm-1.2.2/client.c:796: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). if (cut >= (strlen(c->name) / 2)) break; data/lwm-1.2.2/client.c:799:26: [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). sprintf(&c->menu_name[(strlen(c->name) / 2) - cut], dots); data/lwm-1.2.2/client.c:801:14: [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). &c->name[(strlen(c->name) / 2) + cut]); data/lwm-1.2.2/client.c:802: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). c->menu_namelen = strlen(c->menu_name); data/lwm-1.2.2/lwm.c:392:13: [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 = 9 + strlen(display_string) + ((dot == 0) ? 2 : 0) + 10; data/lwm-1.2.2/resource.c:47:13: [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 = malloc(strlen(p) + 1); data/lwm-1.2.2/session.c:101:26: [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). user_id.v.length = pw ? strlen(pw->pw_name) : 0; data/lwm-1.2.2/session.c:118: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). pid.v.length = strlen(pid_s); data/lwm-1.2.2/session.c:136: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). clone_command.vals[i].length = strlen(session_argv[i]); data/lwm-1.2.2/session.c:148:36: [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). restart_command.vals[i].length = strlen(session_argv[i]); data/lwm-1.2.2/session.c:154: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). restart_command.vals[i].length = strlen(client_id); ANALYSIS SUMMARY: Hits = 33 Lines analyzed = 4796 in approximately 0.12 seconds (39667 lines/second) Physical Source Lines of Code (SLOC) = 3412 Hits@level = [0] 15 [1] 15 [2] 11 [3] 1 [4] 6 [5] 0 Hits@level+ = [0+] 48 [1+] 33 [2+] 18 [3+] 7 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 14.068 [1+] 9.67175 [2+] 5.2755 [3+] 2.05158 [4+] 1.7585 [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.