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/sawfish-1.12.0/src/client.c Examining data/sawfish-1.12.0/src/colors.c Examining data/sawfish-1.12.0/src/cursors.c Examining data/sawfish-1.12.0/src/display.c Examining data/sawfish-1.12.0/src/events.c Examining data/sawfish-1.12.0/src/flippers.c Examining data/sawfish-1.12.0/src/fonts.c Examining data/sawfish-1.12.0/src/frames.c Examining data/sawfish-1.12.0/src/functions.c Examining data/sawfish-1.12.0/src/gradient.c Examining data/sawfish-1.12.0/src/gtk-style.c Examining data/sawfish-1.12.0/src/images.c Examining data/sawfish-1.12.0/src/keys.c Examining data/sawfish-1.12.0/src/keys.h Examining data/sawfish-1.12.0/src/libclient.c Examining data/sawfish-1.12.0/src/libclient.h Examining data/sawfish-1.12.0/src/main.c Examining data/sawfish-1.12.0/src/multihead.c Examining data/sawfish-1.12.0/src/pixmap-cache.c Examining data/sawfish-1.12.0/src/property-cache.c Examining data/sawfish-1.12.0/src/sawfish.h Examining data/sawfish-1.12.0/src/sawfish_subrs.h Examining data/sawfish-1.12.0/src/selection.c Examining data/sawfish-1.12.0/src/server.c Examining data/sawfish-1.12.0/src/server.h Examining data/sawfish-1.12.0/src/session.c Examining data/sawfish-1.12.0/src/stacking-list.c Examining data/sawfish-1.12.0/src/x.c Examining data/sawfish-1.12.0/src/windows.c FINAL RESULTS: data/sawfish-1.12.0/src/server.c:258:6: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod (namebuf, 0700); data/sawfish-1.12.0/src/display.c:175:6: [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 (ptr, rep_STR(host)); data/sawfish-1.12.0/src/display.c:189:6: [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 (buf, fq); data/sawfish-1.12.0/src/display.c:199:2: [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 (ptr, name); data/sawfish-1.12.0/src/fonts.c:180:5: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (buf, len + 1, XLFD_FORMAT, xlfd, weight, slant, pxlsz, pxlsz); data/sawfish-1.12.0/src/fonts.c:182:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (buf, XLFD_FORMAT, xlfd, weight, slant, pxlsz, pxlsz); data/sawfish-1.12.0/src/fonts.c:216:6: [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 (old_locale, tem); data/sawfish-1.12.0/src/fonts.c:867:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf, "#<font %s:%s>", data/sawfish-1.12.0/src/keys.c:863:7: [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 (end, x->name); data/sawfish-1.12.0/src/keys.c:878:6: [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(end, x->name); data/sawfish-1.12.0/src/keys.c:886:2: [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(end, tem); data/sawfish-1.12.0/src/libclient.c:150:6: [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 (ptr, host); data/sawfish-1.12.0/src/libclient.c:164:6: [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 (buf, fq); data/sawfish-1.12.0/src/libclient.c:174:2: [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 (ptr, name); data/sawfish-1.12.0/src/libclient.c:181:17: [4] (misc) getlogin: It's often easy to fool getlogin. Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin() for security-related purposes (CWE-807). Use getpwuid(geteuid()) and extract the desired information instead. char *tmp = getlogin (); data/sawfish-1.12.0/src/libclient.c:388:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(addr.sun_path, SAWFISH_SOCK_DIR "/%s", data/sawfish-1.12.0/src/main.c:380:6: [4] (shell) execvp: 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. execvp (*argv, argv); data/sawfish-1.12.0/src/multihead.c:241:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (dpy_name, "%s%d", dpy_copy, i); data/sawfish-1.12.0/src/sawfish.h:356:16: [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. # define DB(x) printf x data/sawfish-1.12.0/src/server.c:192:5: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (namebuf, sizeof(namebuf), SAWFISH_SOCK_DIR, rep_STR(user)); data/sawfish-1.12.0/src/server.c:194:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (namebuf, SAWFISH_SOCK_DIR, rep_STR(user)); data/sawfish-1.12.0/src/server.c:234:5: [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 (namebuf, rep_STR(name)); data/sawfish-1.12.0/src/server.c:237:8: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if(access(namebuf, F_OK) == 0) data/sawfish-1.12.0/src/server.c:242:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access (namebuf, F_OK) == 0) data/sawfish-1.12.0/src/server.c:254:2: [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(addr.sun_path, namebuf); data/sawfish-1.12.0/src/client.c:102:17: [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. char *dpy = getenv ("DISPLAY"); data/sawfish-1.12.0/src/display.c:383:21: [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. display_name = getenv("DISPLAY"); data/sawfish-1.12.0/src/fonts.c:907:17: [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. char *val = getenv ("GDK_USE_XFT"); data/sawfish-1.12.0/src/libclient.c:420:12: [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. display = getenv ("DISPLAY"); data/sawfish-1.12.0/src/main.c:212:8: [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("SAWFISHDIR") != 0) data/sawfish-1.12.0/src/main.c:213:43: [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. Fset (Qsawfish_directory, rep_string_dup(getenv("SAWFISHDIR"))); data/sawfish-1.12.0/src/main.c:218:8: [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("SAWFISHLISPDIR") != 0) data/sawfish-1.12.0/src/main.c:221: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. rep_string_dup(getenv("SAWFISHLISPDIR"))); data/sawfish-1.12.0/src/main.c:227:8: [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("SAWFISHSITELISPDIR") != 0) data/sawfish-1.12.0/src/main.c:230: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. rep_string_dup(getenv("SAWFISHSITELISPDIR"))); data/sawfish-1.12.0/src/main.c:240:8: [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("SAWFISHEXECDIR") != 0) data/sawfish-1.12.0/src/main.c:241:48: [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. Fset (Qsawfish_exec_directory, rep_string_dup(getenv("SAWFISHEXECDIR"))); data/sawfish-1.12.0/src/main.c:248:8: [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("SAWFISHDOCFILE") != 0) data/sawfish-1.12.0/src/main.c:249:44: [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. Fset (Qdocumentation_file, rep_string_dup(getenv("SAWFISHDOCFILE"))); data/sawfish-1.12.0/src/main.c:262:8: [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("SAWFISH_USER_LISP_DIR") != 0){ data/sawfish-1.12.0/src/main.c:264:20: [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. split_by_colon(getenv("SAWFISH_USER_LISP_DIR"))); data/sawfish-1.12.0/src/main.c:283:8: [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("SAWFISH_USER_LISP_DIR") != 0){ data/sawfish-1.12.0/src/main.c:284:28: [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. tem = split_by_colon(getenv("SAWFISH_USER_LISP_DIR")); data/sawfish-1.12.0/src/multihead.c:211: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. dpy_name = getenv ("DISPLAY"); data/sawfish-1.12.0/src/colors.c:115: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 buf[32]; data/sawfish-1.12.0/src/colors.c:117: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 (buf, "#%04x%04x%04x", data/sawfish-1.12.0/src/colors.c:175: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 buf[256]; data/sawfish-1.12.0/src/colors.c:176: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 (buf, "#<color #%04x%04x%04x>", data/sawfish-1.12.0/src/cursors.c:203: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 buf[256]; data/sawfish-1.12.0/src/cursors.c:204: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 (buf, "#<cursor %x>", (unsigned int) VCURSOR(obj)->cursor); data/sawfish-1.12.0/src/display.c:134:12: [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 buf[256]; data/sawfish-1.12.0/src/display.c:167:12: [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 buf[256]; data/sawfish-1.12.0/src/display.c:197: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 (ptr, ".0"); data/sawfish-1.12.0/src/display.c:380:24: [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). preferred_depth = atoi (rep_STR (opt)); data/sawfish-1.12.0/src/display.c:423:17: [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[50]; data/sawfish-1.12.0/src/events.c:40: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 *event_names[LASTEvent]; data/sawfish-1.12.0/src/fonts.c:147:6: [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 (buf, p + 1, len); data/sawfish-1.12.0/src/fonts.c:866: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 buf[256]; data/sawfish-1.12.0/src/frames.c:128: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 buf[128]; data/sawfish-1.12.0/src/frames.c:129: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 (buf, "#<frame-part %lx>", VPART(win)->id); data/sawfish-1.12.0/src/functions.c:860:6: [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 (rep_STR(data), ev.data.b, MAX(rep_STRING_LEN(data), 20)); data/sawfish-1.12.0/src/gradient.c:27:14: [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 from[3], to[3]; data/sawfish-1.12.0/src/gradient.c:69:14: [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 from[3], to[3]; data/sawfish-1.12.0/src/images.c:418:3: [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 (buf, left, channels); data/sawfish-1.12.0/src/images.c:419:3: [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 (left, right, channels); data/sawfish-1.12.0/src/images.c:420:3: [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 (right, buf, channels); data/sawfish-1.12.0/src/images.c:451:6: [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 (buf, top, stride); data/sawfish-1.12.0/src/images.c:452:6: [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 (top, bottom, stride); data/sawfish-1.12.0/src/images.c:453:6: [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 (bottom, buf, stride); data/sawfish-1.12.0/src/images.c:495:3: [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 (out_pixels + x * out_stride + y * channels, data/sawfish-1.12.0/src/images.c:1067:6: [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 (dst_im->rgb_data + dst_y*dst_width*3 + x*3, data/sawfish-1.12.0/src/images.c:1172:7: [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 (img1_pixel, img2_pixel, 3); data/sawfish-1.12.0/src/images.c:1747: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 buf[256]; data/sawfish-1.12.0/src/images.c:1748: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 (buf, "#<image %dx%d>", data/sawfish-1.12.0/src/keys.c:763: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 buf[100]; data/sawfish-1.12.0/src/keys.c:771: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(buf, desc, tem - desc); data/sawfish-1.12.0/src/keys.c:898: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 buf[256]; data/sawfish-1.12.0/src/keys.c:1085: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 buf[256]; data/sawfish-1.12.0/src/keys.c:1191: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 buf[256]; data/sawfish-1.12.0/src/keys.c:1889:7: [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 str[10]; data/sawfish-1.12.0/src/libclient.c:69: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 buf[256]; data/sawfish-1.12.0/src/libclient.c:109:12: [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 buf[256]; data/sawfish-1.12.0/src/libclient.c:142:12: [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 buf[256]; data/sawfish-1.12.0/src/libclient.c:172: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 (ptr, ".0"); data/sawfish-1.12.0/src/libclient.c:248:6: [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 (ret, data + 1, nitems - 1); data/sawfish-1.12.0/src/multihead.c:94: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 (copy, argv, sizeof (char *) * argc); data/sawfish-1.12.0/src/multihead.c:106: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 (copy, *argvp, sizeof (char *) * *argcp); data/sawfish-1.12.0/src/selection.c:114:3: [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 (rep_STR(res) + offset, prop, nitems); data/sawfish-1.12.0/src/server.c:176: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 namebuf[256]; data/sawfish-1.12.0/src/session.c:210: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). Bool open, IcePointer *watch_data) data/sawfish-1.12.0/src/session.c:212:9: [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). if (open) data/sawfish-1.12.0/src/session.c:227: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 err[256]; data/sawfish-1.12.0/src/windows.c:1637: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 buf[128]; data/sawfish-1.12.0/src/windows.c:1638: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 (buf, "#<window %lx>", VWIN(win)->id); data/sawfish-1.12.0/src/x.c:1464: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 buf[256]; data/sawfish-1.12.0/src/x.c:1465: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 (buf, "#<x-gc>"); data/sawfish-1.12.0/src/x.c:1509: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 buf[256]; data/sawfish-1.12.0/src/x.c:1510: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 (buf, "#<x-drawable 0x%lx>", VX_DRAWABLE (obj)->id); data/sawfish-1.12.0/src/display.c:178: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). ptr += strlen (ptr); data/sawfish-1.12.0/src/display.c:190:18: [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). ptr = buf + strlen (buf); data/sawfish-1.12.0/src/events.c:522: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). tprop.nitems = strlen ((char *) prop); data/sawfish-1.12.0/src/fonts.c:144: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). end = p + strlen (p); data/sawfish-1.12.0/src/fonts.c:176: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 (xlfd) + strlen (weight) + strlen (slant) + data/sawfish-1.12.0/src/fonts.c:176:27: [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 (xlfd) + strlen (weight) + strlen (slant) + data/sawfish-1.12.0/src/fonts.c:176: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). len = strlen (xlfd) + strlen (weight) + strlen (slant) + data/sawfish-1.12.0/src/fonts.c:177: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). strlen (pxlsz) + strlen (pxlsz) + strlen (XLFD_FORMAT); data/sawfish-1.12.0/src/fonts.c:177:28: [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 (pxlsz) + strlen (pxlsz) + strlen (XLFD_FORMAT); data/sawfish-1.12.0/src/fonts.c:177: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). strlen (pxlsz) + strlen (pxlsz) + strlen (XLFD_FORMAT); data/sawfish-1.12.0/src/fonts.c:215:27: [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). old_locale = alloca (strlen (tem) + 1); data/sawfish-1.12.0/src/functions.c:1105: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). end = ptr + strlen (ptr); data/sawfish-1.12.0/src/functions.c:1242: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). end = ptr + strlen (ptr); data/sawfish-1.12.0/src/keys.c:864: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). end += strlen (x->name); data/sawfish-1.12.0/src/keys.c:911: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). bufp += strlen (bufp); data/sawfish-1.12.0/src/libclient.c:83:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, uts.nodename, 256); data/sawfish-1.12.0/src/libclient.c:153: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). ptr += strlen (ptr); data/sawfish-1.12.0/src/libclient.c:165:18: [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). ptr = buf + strlen (buf); data/sawfish-1.12.0/src/libclient.c:205:63: [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). PropModeReplace, (unsigned char *) form, strlen (form)); data/sawfish-1.12.0/src/libclient.c:334:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). SOCK_IO (read, fd, buf, len); data/sawfish-1.12.0/src/libclient.c:343:25: [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). unsigned long len = strlen(form); data/sawfish-1.12.0/src/libclient.c:396: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). sizeof(addr.sun_family) + strlen(addr.sun_path) + 1) == 0) data/sawfish-1.12.0/src/multihead.c:52:18: [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 optlen = strlen (option); data/sawfish-1.12.0/src/multihead.c:240:25: [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). dpy_name = malloc (strlen (dpy_copy) + 6); data/sawfish-1.12.0/src/server.c:80:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). SOCK_IO (read, fd, buf, len); data/sawfish-1.12.0/src/server.c:233:5: [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 (namebuf, "/"); data/sawfish-1.12.0/src/server.c:256:29: [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). sizeof(addr.sun_family) + strlen(addr.sun_path) + 1) == 0) data/sawfish-1.12.0/src/windows.c:372: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). prop->nitems = strlen((char *) prop->value); data/sawfish-1.12.0/src/x.c:1066:53: [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). &VX_GC (gc)->fg_copy, x, y, str, strlen (str)); data/sawfish-1.12.0/src/x.c:1096:25: [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). XTextItem text={str,strlen(str),0,0}; ANALYSIS SUMMARY: Hits = 128 Lines analyzed = 19344 in approximately 3.79 seconds (5103 lines/second) Physical Source Lines of Code (SLOC) = 14566 Hits@level = [0] 42 [1] 30 [2] 54 [3] 19 [4] 24 [5] 1 Hits@level+ = [0+] 170 [1+] 128 [2+] 98 [3+] 44 [4+] 25 [5+] 1 Hits/KSLOC@level+ = [0+] 11.671 [1+] 8.78759 [2+] 6.728 [3+] 3.02073 [4+] 1.71633 [5+] 0.068653 Dot directories skipped = 2 (--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.