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/gnuserv-3.12.8/getopt.c Examining data/gnuserv-3.12.8/gnuslib.c Examining data/gnuserv-3.12.8/compiler.h Examining data/gnuserv-3.12.8/syssignal.h Examining data/gnuserv-3.12.8/getopt.h Examining data/gnuserv-3.12.8/gnuserv.h Examining data/gnuserv-3.12.8/acconfig.h Examining data/gnuserv-3.12.8/gnuclient.c Examining data/gnuserv-3.12.8/gnuserv.c Examining data/gnuserv-3.12.8/sysfile.h FINAL RESULTS: data/gnuserv-3.12.8/gnuclient.c:207:8: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (fullpath, filename, QXE_PATH_MAX); data/gnuserv-3.12.8/gnuclient.c:215:7: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (fullpath, get_current_working_directory (), QXE_PATH_MAX); data/gnuserv-3.12.8/gnuserv.c:787:11: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(server.sun_path, 0700) < 0) data/gnuserv-3.12.8/gnuserv.c:820:3: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(server.sun_path,0700); /* only this user can send commands */ data/gnuserv-3.12.8/compiler.h:114:35: [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. __attribute__ ((format (printf, string_index, first_to_check))) data/gnuserv-3.12.8/gnuclient.c:299:5: [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 (new_s, s); data/gnuserv-3.12.8/gnuclient.c:465:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, data/gnuserv-3.12.8/gnuclient.c:499:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (command, "(gnuserv-eval%s '(progn ", quick ? "-quickly" : ""); data/gnuserv-3.12.8/gnuclient.c:537:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (command, "(gnuserv-eval%s '(progn ", quick ? "-quickly" : ""); data/gnuserv-3.12.8/gnuclient.c:615:8: [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 (remotepath, thishost); data/gnuserv-3.12.8/gnuclient.c:645:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (command, "(gnuserv-edit-files '(tty %s %s %d) '(", data/gnuserv-3.12.8/gnuclient.c:654:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (command, "(gnuserv-edit-files '(x %s) '(", data/gnuserv-3.12.8/gnuclient.c:686:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (path, "%s%s", remotepath, fullpath); data/gnuserv-3.12.8/gnuclient.c:690:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (command, "(%d . %s)", starting_line, clean_string (path)); data/gnuserv-3.12.8/gnuclient.c:695:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (command, ")%s%s", data/gnuserv-3.12.8/gnuserv.c:143:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf,"%s/gsrv%d",tmpdir,(int)geteuid ()); data/gnuserv-3.12.8/gnuserv.c:649:15: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. while ((fscanf(host_file,"%s",hostname) != EOF)) /* find a host */ data/gnuserv-3.12.8/gnuserv.c:783:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(server.sun_path,"%s/gsrvdir%d",tmpdir,(int)geteuid()); data/gnuserv-3.12.8/gnuserv.c:798:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(server.sun_path,"%s/gsrv%d",tmpdir,(int)geteuid()); data/gnuserv-3.12.8/gnuserv.h:127:6: [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(msgp->mtext,str); \ data/gnuserv-3.12.8/gnuslib.c:138:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%s/gsrv%d",tmpdir,(int)geteuid()); data/gnuserv-3.12.8/gnuslib.c:242: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(dest,buffer); data/gnuserv-3.12.8/gnuslib.c:266:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(server.sun_path,"%s/gsrvdir%d/gsrv",tmpdir,(int)geteuid()); data/gnuserv-3.12.8/gnuslib.c:268:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(server.sun_path,"%s/gsrv%d",tmpdir,(int)geteuid()); data/gnuserv-3.12.8/gnuslib.c:376:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s\n%d\n", MCOOKIE_NAME, server_xauth->data_length); data/gnuserv-3.12.8/gnuslib.c:385:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (buf, "%s\n", DEFAUTH_NAME); data/gnuserv-3.12.8/getopt.c:388: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. posixly_correct = getenv ("POSIXLY_CORRECT"); data/gnuserv-3.12.8/getopt.c:949:1: [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. getopt (int argc, char *const *argv, const char *optstring) data/gnuserv-3.12.8/getopt.c:974:11: [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. c = getopt (argc, argv, "abc:d:0123456789"); data/gnuserv-3.12.8/getopt.h:105:12: [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. extern int getopt (int argc, char *const *argv, const char *shortopts); data/gnuserv-3.12.8/getopt.h:107:12: [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. extern int getopt (); data/gnuserv-3.12.8/getopt.h:109:12: [3] (buffer) getopt_long: 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. extern int getopt_long (int argc, char *const *argv, const char *shortopts, data/gnuserv-3.12.8/gnuclient.c:158:11: [3] (buffer) getwd: This does not protect against buffer overflows by itself, so use with caution (CWE-120, CWE-20). Use getcwd instead. if (getwd (cwd) == 0) data/gnuserv-3.12.8/gnuclient.c:349: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. tmpdir = getenv ("TEMP"); data/gnuserv-3.12.8/gnuclient.c:351:14: [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. tmpdir = getenv ("TMP"); data/gnuserv-3.12.8/gnuclient.c:356: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. tmpdir = getenv ("TMPDIR"); data/gnuserv-3.12.8/gnuclient.c:361: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. display = getenv ("DISPLAY"); data/gnuserv-3.12.8/gnuclient.c:605:19: [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 ((ptr = getenv ("GNU_NODE")) != NULL) data/gnuserv-3.12.8/gnuclient.c:639: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 *term = getenv ("TERM"); data/gnuserv-3.12.8/gnuserv.c:646: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. if (((file_name = getenv("GNU_SECURE")) != NULL && /* security file */ data/gnuserv-3.12.8/gnuserv.c:688: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. if ((ptr=getenv("GNU_PORT")) != NULL) data/gnuserv-3.12.8/gnuserv.c:889: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. tmpdir = getenv ("TEMP"); data/gnuserv-3.12.8/gnuserv.c:891:14: [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. tmpdir = getenv ("TMP"); data/gnuserv-3.12.8/gnuserv.c:896: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. tmpdir = getenv ("TMPDIR"); data/gnuserv-3.12.8/gnuslib.c:85:15: [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. hostarg = getenv("GNU_HOST"); data/gnuserv-3.12.8/gnuslib.c:86: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. if (portarg == 0 && (ptr=getenv("GNU_PORT")) != NULL) data/gnuserv-3.12.8/getopt.c:319: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 (new_str, __getopt_nonoption_flags, nonoption_flags_max_len); data/gnuserv-3.12.8/getopt.c:428: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 (__getopt_nonoption_flags, orig_str, len); data/gnuserv-3.12.8/gnuclient.c:77: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 cwd[QXE_PATH_MAX+2];/* current working directory when calculated */ data/gnuserv-3.12.8/gnuclient.c:91: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 buffer[GSERV_BUFSZ+1]; data/gnuserv-3.12.8/gnuclient.c:104: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(buffer,"(gnuserv-eval '(resume-pid-console %d))", (int)getpid()); data/gnuserv-3.12.8/gnuclient.c:189: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 cygwinFilename[QXE_PATH_MAX+1]; data/gnuserv-3.12.8/gnuclient.c:307: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 command[QXE_PATH_MAX+50];/* emacs command buffer */ data/gnuserv-3.12.8/gnuclient.c:308: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 fullpath[QXE_PATH_MAX+1];/* full pathname to file */ data/gnuserv-3.12.8/gnuclient.c:327: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 thishost[HOSTNAMSZ]; /* this hostname */ data/gnuserv-3.12.8/gnuclient.c:328: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 remotepath[QXE_PATH_MAX+1]; /* remote pathname */ data/gnuserv-3.12.8/gnuclient.c:334: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 buffer[GSERV_BUFSZ + 1]; /* buffer to read pid */ data/gnuserv-3.12.8/gnuclient.c:335: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 result[GSERV_BUFSZ + 1]; data/gnuserv-3.12.8/gnuclient.c:448:12: [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). port = atoi (portarg); data/gnuserv-3.12.8/gnuclient.c:587:23: [2] (integer) atol: 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). emacs_pid = (pid_t)atol(buffer); data/gnuserv-3.12.8/gnuclient.c:613:8: [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 (remotepath, "/net/"); /* (this fails using internet data/gnuserv-3.12.8/gnuclient.c:659:6: [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 (command, "(gnuserv-edit-files '(gtk nil) '("); data/gnuserv-3.12.8/gnuclient.c:663:6: [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 (command, "(gnuserv-edit-files '(mswindows nil) '("); data/gnuserv-3.12.8/gnuclient.c:674:22: [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). starting_line = atoi (argv[i++]); data/gnuserv-3.12.8/gnuserv.c:141: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 buf[GSERV_BUFSZ+1]; /* pathname for key */ data/gnuserv-3.12.8/gnuserv.c:178: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 buf[GSERV_BUFSZ+1]; data/gnuserv-3.12.8/gnuserv.c:291: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 buf[GSERV_BUFSZ]; data/gnuserv-3.12.8/gnuserv.c:324: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 buf[GSERV_BUFSZ+1]; data/gnuserv-3.12.8/gnuserv.c:460: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 auth_protocol[128]; data/gnuserv-3.12.8/gnuserv.c:461: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 buf[1024]; data/gnuserv-3.12.8/gnuserv.c:493:20: [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). auth_data_len = atoi (buf); data/gnuserv-3.12.8/gnuserv.c:602: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 hostname[HOSTNAMSZ]; data/gnuserv-3.12.8/gnuserv.c:647:21: [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). (host_file = fopen(file_name,"r")) != NULL)) /* opened ok */ data/gnuserv-3.12.8/gnuserv.c:689:29: [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). server.sin_port = htons(atoi(ptr)); data/gnuserv-3.12.8/gnuserv.c:795:3: [2] (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 string. strcat(server.sun_path,"/gsrv"); data/gnuserv-3.12.8/gnuslib.c:87:15: [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). portarg = atoi(ptr); data/gnuserv-3.12.8/gnuslib.c:117: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 localhost[HOSTNAMSZ]; data/gnuserv-3.12.8/gnuslib.c:136: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 buf[GSERV_BUFSZ+1]; /* buffer for filename */ data/gnuserv-3.12.8/gnuslib.c:233: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 buffer[GSERV_BUFSZ+1]; data/gnuserv-3.12.8/gnuslib.c:321: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 buf[512]; /* temporary buffer */ data/gnuserv-3.12.8/gnuslib.c:403: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 buffer[REPLYSIZ+1]; data/gnuserv-3.12.8/gnuslib.c:405: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 buffer[GSERV_BUFSZ+1]; data/gnuserv-3.12.8/getopt.c:225: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). extern int strlen (const char *); data/gnuserv-3.12.8/getopt.c:419: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). int len = nonoption_flags_max_len = strlen (orig_str); data/gnuserv-3.12.8/getopt.c:638: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). == (unsigned int) strlen (p->name)) data/gnuserv-3.12.8/getopt.c:662:16: [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). nextchar += strlen (nextchar); data/gnuserv-3.12.8/getopt.c:692: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). nextchar += strlen (nextchar); data/gnuserv-3.12.8/getopt.c:708: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). nextchar += strlen (nextchar); data/gnuserv-3.12.8/getopt.c:713:16: [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). nextchar += strlen (nextchar); data/gnuserv-3.12.8/getopt.c:824: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). if ((unsigned int) (nameend - nextchar) == strlen (p->name)) data/gnuserv-3.12.8/getopt.c:847: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). nextchar += strlen (nextchar); data/gnuserv-3.12.8/getopt.c:867: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). nextchar += strlen (nextchar); data/gnuserv-3.12.8/getopt.c:881: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). nextchar += strlen (nextchar); data/gnuserv-3.12.8/getopt.c:885: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). nextchar += strlen (nextchar); data/gnuserv-3.12.8/gnuclient.c:216: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 = strlen (fullpath); data/gnuserv-3.12.8/gnuclient.c:221:4: [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 (fullpath, "/"); data/gnuserv-3.12.8/gnuclient.c:226:7: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat (fullpath, filename, QXE_PATH_MAX - len); data/gnuserv-3.12.8/gnuclient.c:297: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 *new_s = (char *) malloc (strlen (s) + 1); data/gnuserv-3.12.8/gnuclient.c:452:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (remotepath, remotearg, QXE_PATH_MAX); data/gnuserv-3.12.8/gnuclient.c:540:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((nb = read(fileno(stdin), buffer, GSERV_BUFSZ-1)) > 0) data/gnuserv-3.12.8/gnuclient.c:607:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (remotepath, ptr, QXE_PATH_MAX); data/gnuserv-3.12.8/gnuclient.c:685: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). path = (char *) malloc (strlen (remotepath) + strlen (fullpath) + 1); data/gnuserv-3.12.8/gnuclient.c:685:50: [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). path = (char *) malloc (strlen (remotepath) + strlen (fullpath) + 1); data/gnuserv-3.12.8/gnuserv.c:192:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (buf, msgp->mtext, len); data/gnuserv-3.12.8/gnuserv.c:202:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = read(0,buf,GSERV_BUFSZ-1)) < 0) data/gnuserv-3.12.8/gnuserv.c:215:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ((len = read (0, buf + offset, 1)) > 0) && data/gnuserv-3.12.8/gnuserv.c:234:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = read(0, buf, min2 (result_len, GSERV_BUFSZ - 1))) < 0) data/gnuserv-3.12.8/gnuserv.c:251: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). total += strlen(buf); data/gnuserv-3.12.8/gnuserv.c:258:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((len = read (0,buf,1)) == 0) data/gnuserv-3.12.8/gnuserv.c:276: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). if (msgsnd (ipc_qid,msgp,strlen(msgp->mtext)+1,0) < 0) data/gnuserv-3.12.8/gnuserv.c:332:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ((len = read(0,buf+offset,1)) > 0) && data/gnuserv-3.12.8/gnuserv.c:348:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = read(0,buf,min2(result_len,GSERV_BUFSZ))) < 0) { data/gnuserv-3.12.8/gnuserv.c:359:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((len = read(0,buf,1)) == 0) data/gnuserv-3.12.8/gnuserv.c:417:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read (fd, &c, 1) == 1 ) data/gnuserv-3.12.8/gnuserv.c:623:8: [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(MCOOKIE_SCREEN), MCOOKIE_SCREEN, data/gnuserv-3.12.8/gnuserv.c:624:8: [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(MCOOKIE_X_NAME), MCOOKIE_X_NAME); data/gnuserv-3.12.8/gnuserv.c:807: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 (server.sun_path) + 1); data/gnuserv-3.12.8/gnuserv.c:810: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). bindlen = strlen (server.sun_path) + sizeof (server.sun_family); data/gnuserv-3.12.8/gnuserv.h:126:7: [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 (strlen(msgp->mtext) + strlen(str) < GSERV_BUFSZ) \ data/gnuserv-3.12.8/gnuserv.h:126: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). if (strlen(msgp->mtext) + strlen(str) < GSERV_BUFSZ) \ data/gnuserv-3.12.8/gnuslib.c:170: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). if(msgsnd(s,msgp,strlen(msgp->mtext)+1,0) < 0) { data/gnuserv-3.12.8/gnuslib.c:200: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). if (send(s,msg,strlen(msg),0) < 0) { data/gnuserv-3.12.8/gnuslib.c:206: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). int len, left=strlen(msg); data/gnuserv-3.12.8/gnuslib.c:235:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((length=read(s,buffer+offset,1)>0) && buffer[offset]!='\n' data/gnuserv-3.12.8/gnuslib.c:270: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). if (connect(s,(struct sockaddr *)&server,strlen(server.sun_path)+2) < 0) { data/gnuserv-3.12.8/gnuslib.c:372:8: [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(MCOOKIE_SCREEN), MCOOKIE_SCREEN, data/gnuserv-3.12.8/gnuslib.c:373:8: [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(MCOOKIE_X_NAME), MCOOKIE_X_NAME); data/gnuserv-3.12.8/gnuslib.c:377: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). write (s, buf, strlen(buf)); data/gnuserv-3.12.8/gnuslib.c:386: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). write (s, buf, strlen(buf)); data/gnuserv-3.12.8/gnuslib.c:435:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((length = read(s,buffer,GSERV_BUFSZ)) > 0 || ANALYSIS SUMMARY: Hits = 130 Lines analyzed = 4701 in approximately 0.16 seconds (29206 lines/second) Physical Source Lines of Code (SLOC) = 2961 Hits@level = [0] 93 [1] 48 [2] 36 [3] 20 [4] 22 [5] 4 Hits@level+ = [0+] 223 [1+] 130 [2+] 82 [3+] 46 [4+] 26 [5+] 4 Hits/KSLOC@level+ = [0+] 75.3124 [1+] 43.9041 [2+] 27.6933 [3+] 15.5353 [4+] 8.78082 [5+] 1.35089 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.