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/vncsnapshot-1.2a/rfbproto.c Examining data/vncsnapshot-1.2a/buffer.c Examining data/vncsnapshot-1.2a/cursor.c Examining data/vncsnapshot-1.2a/d3des.c Examining data/vncsnapshot-1.2a/d3des.h Examining data/vncsnapshot-1.2a/getpass.c Examining data/vncsnapshot-1.2a/listen.c Examining data/vncsnapshot-1.2a/rfbproto.h Examining data/vncsnapshot-1.2a/vncpasswd.c Examining data/vncsnapshot-1.2a/stdhdrs.h Examining data/vncsnapshot-1.2a/sockets.cxx Examining data/vncsnapshot-1.2a/version.h Examining data/vncsnapshot-1.2a/vncauth.c Examining data/vncsnapshot-1.2a/vncauth.h Examining data/vncsnapshot-1.2a/vncsnapshot.c Examining data/vncsnapshot-1.2a/libjpeg/jconfig.h Examining data/vncsnapshot-1.2a/libjpeg/jmorecfg.h Examining data/vncsnapshot-1.2a/rdr/FdOutStream.cxx Examining data/vncsnapshot-1.2a/rdr/Exception.h Examining data/vncsnapshot-1.2a/rdr/FdInStream.cxx Examining data/vncsnapshot-1.2a/rdr/FdInStream.h Examining data/vncsnapshot-1.2a/rdr/FixedMemOutStream.h Examining data/vncsnapshot-1.2a/rdr/FdOutStream.h Examining data/vncsnapshot-1.2a/rdr/InStream.cxx Examining data/vncsnapshot-1.2a/rdr/InStream.h Examining data/vncsnapshot-1.2a/rdr/MemInStream.h Examining data/vncsnapshot-1.2a/rdr/MemOutStream.h Examining data/vncsnapshot-1.2a/rdr/NullOutStream.cxx Examining data/vncsnapshot-1.2a/rdr/NullOutStream.h Examining data/vncsnapshot-1.2a/rdr/OutStream.h Examining data/vncsnapshot-1.2a/rdr/ZlibInStream.cxx Examining data/vncsnapshot-1.2a/rdr/ZlibInStream.h Examining data/vncsnapshot-1.2a/rdr/ZlibOutStream.cxx Examining data/vncsnapshot-1.2a/rdr/ZlibOutStream.h Examining data/vncsnapshot-1.2a/rdr/types.h Examining data/vncsnapshot-1.2a/vncsnapshot.h Examining data/vncsnapshot-1.2a/zrle.cxx Examining data/vncsnapshot-1.2a/protocols/corre.c Examining data/vncsnapshot-1.2a/protocols/hextile.c Examining data/vncsnapshot-1.2a/protocols/rre.c Examining data/vncsnapshot-1.2a/protocols/tight.c Examining data/vncsnapshot-1.2a/protocols/zlib.c Examining data/vncsnapshot-1.2a/rfb/zrleDecode.h Examining data/vncsnapshot-1.2a/rfb/zrleEncode.h Examining data/vncsnapshot-1.2a/rfb.h Examining data/vncsnapshot-1.2a/tunnel.c Examining data/vncsnapshot-1.2a/argsresources.c FINAL RESULTS: data/vncsnapshot-1.2a/vncauth.c:69:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(fname, S_IRUSR|S_IWUSR); data/vncsnapshot-1.2a/argsresources.c:279: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(vncServerHost, vncServerName); data/vncsnapshot-1.2a/getpass.c:31:7: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. char *getpass(const char * prompt) data/vncsnapshot-1.2a/rfbproto.c:166:7: [4] (buffer) sscanf: 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. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(pv,rfbProtocolVersionFormat,&major,&minor) != 2) { data/vncsnapshot-1.2a/rfbproto.c:179:3: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(pv,rfbProtocolVersionFormat,major,minor); data/vncsnapshot-1.2a/rfbproto.c:216:16: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. passwd = getpass("Password: "); data/vncsnapshot-1.2a/sockets.cxx:195:5: [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,programName); data/vncsnapshot-1.2a/sockets.cxx:201:5: [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,programName); data/vncsnapshot-1.2a/sockets.cxx:209:5: [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,programName); data/vncsnapshot-1.2a/sockets.cxx:236:5: [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,programName); data/vncsnapshot-1.2a/sockets.cxx:271:5: [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,programName); data/vncsnapshot-1.2a/sockets.cxx:278:5: [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,programName); data/vncsnapshot-1.2a/sockets.cxx:285:5: [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,programName); data/vncsnapshot-1.2a/sockets.cxx:292:5: [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,programName); data/vncsnapshot-1.2a/sockets.cxx:315:5: [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,programName); data/vncsnapshot-1.2a/sockets.cxx:322:5: [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,programName); data/vncsnapshot-1.2a/tunnel.c:278:7: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (system(cmd) != 0) { data/vncsnapshot-1.2a/vncpasswd.c:45:29: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. #define vnc_getpass(prompt) getpass(prompt) data/vncsnapshot-1.2a/vncpasswd.c:70:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(passwdFile,"%s/.vnc/passwd",getenv("HOME")); data/vncsnapshot-1.2a/vncpasswd.c:76: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(passwdFile,argv[1]); data/vncsnapshot-1.2a/vncsnapshot.c:146:11: [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(filename, appData.outputFilename); data/vncsnapshot-1.2a/vncsnapshot.c:157:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(append, "%05d%s", count, suffix); data/vncsnapshot-1.2a/vncsnapshot.h:218:14: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. extern char *getpass(const char * prompt); data/vncsnapshot-1.2a/tunnel.c:200: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. pattern = getenv((tunnelOption) ? "VNC_TUNNEL_CMD" : "VNC_VIA_CMD"); data/vncsnapshot-1.2a/vncpasswd.c:66:11: [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("HOME") == NULL) { data/vncsnapshot-1.2a/vncpasswd.c:70: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. sprintf(passwdFile,"%s/.vnc/passwd",getenv("HOME")); data/vncsnapshot-1.2a/argsresources.c:72:1: [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 vncServerHost[256]; data/vncsnapshot-1.2a/argsresources.c:148:27: [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 = *(char **)cmdLineOptions[i].arg; data/vncsnapshot-1.2a/argsresources.c:282: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(vncServerHost, vncServerName, colonPos - vncServerName); data/vncsnapshot-1.2a/argsresources.c:295:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). vncServerPort = atoi(colonPos + 1) + portOffset; data/vncsnapshot-1.2a/buffer.c:236:22: [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). if ((outfile = fopen(filename, "wb")) == NULL) { data/vncsnapshot-1.2a/d3des.c:57: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. static unsigned char pc1[56] = { data/vncsnapshot-1.2a/d3des.c:63: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. static unsigned char totrot[16] = { data/vncsnapshot-1.2a/d3des.c:66: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. static unsigned char pc2[48] = { data/vncsnapshot-1.2a/d3des.c:77:18: [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 pc1m[56], pcr[56]; data/vncsnapshot-1.2a/getpass.c:29: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 buffer[512]; data/vncsnapshot-1.2a/listen.c:61: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 flashUser[256]; data/vncsnapshot-1.2a/listen.c:69:39: [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). listenPort = LISTEN_PORT_OFFSET + atoi(argv[listenArgIndex+1]); data/vncsnapshot-1.2a/listen.c:70:37: [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). flashPort = FLASH_PORT_OFFSET + atoi(argv[listenArgIndex+1]); data/vncsnapshot-1.2a/protocols/tight.c:271: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(buffer, &buffer[numRows * rowSize], extraBytes); data/vncsnapshot-1.2a/protocols/tight.c:339: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 (dst, buffer, numRows * rectWidth * (BPP / 8)); data/vncsnapshot-1.2a/protocols/tight.c:391: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(tightPrevRow, thisRow, rectWidth * 3); data/vncsnapshot-1.2a/protocols/tight.c:447: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(thatRow, thisRow, rectWidth * 3 * sizeof(CARD16)); data/vncsnapshot-1.2a/rdr/Exception.h:29: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 str_[len]; data/vncsnapshot-1.2a/rdr/Exception.h:50: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 buf[20]; data/vncsnapshot-1.2a/rdr/Exception.h:51: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(buf,"%d",err); data/vncsnapshot-1.2a/rdr/FdInStream.cxx:88: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(dataPtr, ptr, n); data/vncsnapshot-1.2a/rdr/InStream.h:92:9: [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(dataPtr, ptr, n); data/vncsnapshot-1.2a/rdr/MemOutStream.h:45: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(ptr, data, length); data/vncsnapshot-1.2a/rdr/MemOutStream.h:68: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(newStart, start, ptr - start); data/vncsnapshot-1.2a/rdr/OutStream.h:97:9: [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(ptr, dataPtr, n); data/vncsnapshot-1.2a/rfbproto.c:106: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 buffer[BUFFER_SIZE]; data/vncsnapshot-1.2a/rfbproto.c:128: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 zlib_buffer[ZLIB_BUFFER_SIZE]; data/vncsnapshot-1.2a/rfbproto.c:139: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 tightPalette[256*4]; data/vncsnapshot-1.2a/rfbproto.c:338: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[sz_rfbSetEncodingsMsg + MAX_ENCODINGS * 4]; data/vncsnapshot-1.2a/rfbproto.h:166:9: [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. typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */ data/vncsnapshot-1.2a/sockets.cxx:368: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 c, str[17]; data/vncsnapshot-1.2a/tunnel.c:52: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 lastArgv[32]; data/vncsnapshot-1.2a/tunnel.c:72: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 cmd[1024]; data/vncsnapshot-1.2a/tunnel.c:74: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 localPortStr[8]; data/vncsnapshot-1.2a/tunnel.c:75: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 remotePortStr[8]; data/vncsnapshot-1.2a/tunnel.c:99: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(localPortStr, "%d", localPort); data/vncsnapshot-1.2a/tunnel.c:100: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(remotePortStr, "%d", remotePort); data/vncsnapshot-1.2a/tunnel.c:136:17: [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). *remotePort = atoi(pdisplay); data/vncsnapshot-1.2a/tunnel.c:140: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(lastArgv, "localhost::%d", localPort); /* see argsresources.c, GetArgsAndResources, Two colons comment */ data/vncsnapshot-1.2a/tunnel.c:179:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). *remotePort = atoi(colonPos) + portOffset; data/vncsnapshot-1.2a/tunnel.c:182: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(lastArgv, "localhost::%d", localPort); data/vncsnapshot-1.2a/vncauth.c:51:10: [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 fixedkey[8] = {23,82,107,6,35,78,88,7}; data/vncsnapshot-1.2a/vncauth.c:64: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 encryptedPasswd[8]; data/vncsnapshot-1.2a/vncauth.c:66:15: [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). if ((fp = fopen(fname,"wb")) == NULL) return 1; data/vncsnapshot-1.2a/vncauth.c:109:15: [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). if ((fp = fopen(fname,"r")) == NULL) return NULL; data/vncsnapshot-1.2a/vncauth.c:138: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 key[8]; data/vncsnapshot-1.2a/vncauth.c:198: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(passwd, encryptedPasswd, MAXPWLEN); data/vncsnapshot-1.2a/vncpasswd.c:60: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 passwdFile[256]; data/vncsnapshot-1.2a/vncpasswd.c:124: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 pbuf[50+1]; data/vncsnapshot-1.2a/zrle.cxx:64: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 buffer[BUFFER_SIZE]; data/vncsnapshot-1.2a/argsresources.c:271: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(vncServerName) > 255) { data/vncsnapshot-1.2a/argsresources.c:284: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(colonPos + 1); data/vncsnapshot-1.2a/rdr/Exception.h:32: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(str_, e, len-1); data/vncsnapshot-1.2a/rdr/Exception.h:34:9: [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. Risk is low because the source is a constant string. strncat(str_, ": ", len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:34: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). strncat(str_, ": ", len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:35:9: [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(str_, s, len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:35: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). strncat(str_, s, len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:45: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. Risk is low because the source is a constant string. strncat(str_, "rdr::SystemException: ", len-1); data/vncsnapshot-1.2a/rdr/Exception.h:46: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(str_, s, len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:46:30: [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). strncat(str_, s, len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:47: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. Risk is low because the source is a constant string. strncat(str_, ": ", len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:47: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). strncat(str_, ": ", len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:48: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(str_, strerror(err), len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:48:42: [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). strncat(str_, strerror(err), len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:49: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. Risk is low because the source is a constant string. strncat(str_, " (", len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:49: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). strncat(str_, " (", len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:52: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(str_, buf, len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:52: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). strncat(str_, buf, len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:53: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. Risk is low because the source is a constant character. strncat(str_, ")", len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/Exception.h:53: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). strncat(str_, ")", len-1-strlen(str_)); data/vncsnapshot-1.2a/rdr/FdInStream.cxx:26:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define read(s,b,l) recv(s,(char*)b,l,0) data/vncsnapshot-1.2a/rdr/FdInStream.cxx:184:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = ::read(fd, buf, len); data/vncsnapshot-1.2a/rdr/OutStream.h:73: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). U32 len = strlen(str); data/vncsnapshot-1.2a/rfbproto.c:219:23: [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 ((!passwd) || (strlen(passwd) == 0)) { data/vncsnapshot-1.2a/rfbproto.c:223: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). if (strlen(passwd) > 8) { data/vncsnapshot-1.2a/rfbproto.c:230: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). for (i = strlen(passwd); i >= 0; i--) { data/vncsnapshot-1.2a/rfbproto.c:359: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). encStrLen = strlen(encStr); data/vncsnapshot-1.2a/tunnel.c:133:42: [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 (strspn(pdisplay, "-0123456789") != strlen(pdisplay)) data/vncsnapshot-1.2a/tunnel.c:168: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(colonPos); data/vncsnapshot-1.2a/tunnel.c:228:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(&result[j], remoteHost, 1024 - j); data/vncsnapshot-1.2a/tunnel.c:229: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). j += strlen(remoteHost) - 1; data/vncsnapshot-1.2a/tunnel.c:233:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(&result[j], gatewayHost, 1024 - j); data/vncsnapshot-1.2a/tunnel.c:234: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). j += strlen(gatewayHost) - 1; data/vncsnapshot-1.2a/tunnel.c:238:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(&result[j], remotePort, 1024 - j); data/vncsnapshot-1.2a/tunnel.c:239: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). j += strlen(remotePort) - 1; data/vncsnapshot-1.2a/tunnel.c:243:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(&result[j], localPort, 1024 - j); data/vncsnapshot-1.2a/tunnel.c:244: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). j += strlen(localPort) - 1; data/vncsnapshot-1.2a/vncauth.c:75:10: [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 (i < strlen(passwd)) { data/vncsnapshot-1.2a/vncauth.c:112:7: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getc(fp); data/vncsnapshot-1.2a/vncauth.c:144:10: [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 (i < strlen(passwd)) { data/vncsnapshot-1.2a/vncauth.c:172: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). if (i < strlen(passwd)) { data/vncsnapshot-1.2a/vncpasswd.c:88: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). if (strlen(passwd) < MINPASSWD) { data/vncsnapshot-1.2a/vncpasswd.c:92: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). if (strlen(passwd) > MAXPWLEN) { data/vncsnapshot-1.2a/vncpasswd.c:100: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). if (strlen(passwd) > MAXPWLEN) { data/vncsnapshot-1.2a/vncpasswd.c:109:23: [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(passwd); i++) data/vncsnapshot-1.2a/vncsnapshot.c:112: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). filename = (char *) malloc(strlen(appData.outputFilename) + 11 + 1); data/vncsnapshot-1.2a/vncsnapshot.c:142:11: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename, appData.outputFilename, cp - appData.outputFilename); data/vncsnapshot-1.2a/vncsnapshot.c:148:31: [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). append = filename + strlen(filename); ANALYSIS SUMMARY: Hits = 124 Lines analyzed = 9184 in approximately 0.26 seconds (35227 lines/second) Physical Source Lines of Code (SLOC) = 5246 Hits@level = [0] 119 [1] 48 [2] 50 [3] 3 [4] 22 [5] 1 Hits@level+ = [0+] 243 [1+] 124 [2+] 76 [3+] 26 [4+] 23 [5+] 1 Hits/KSLOC@level+ = [0+] 46.321 [1+] 23.6371 [2+] 14.4872 [3+] 4.95616 [4+] 4.38429 [5+] 0.190621 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.