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/looking-glass-0+b1/c-host/include/interface/capture.h Examining data/looking-glass-0+b1/c-host/include/interface/platform.h Examining data/looking-glass-0+b1/c-host/platform/Linux/capture/XCB/src/xcb.c Examining data/looking-glass-0+b1/c-host/platform/Linux/src/platform.c Examining data/looking-glass-0+b1/c-host/platform/Windows/capture/DXGI/src/dxgi.c Examining data/looking-glass-0+b1/c-host/platform/Windows/capture/DXGI/src/dxgi_extra.h Examining data/looking-glass-0+b1/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c Examining data/looking-glass-0+b1/c-host/platform/Windows/capture/NVFBC/src/wrapper.cpp Examining data/looking-glass-0+b1/c-host/platform/Windows/capture/NVFBC/src/wrapper.h Examining data/looking-glass-0+b1/c-host/platform/Windows/include/windows/debug.h Examining data/looking-glass-0+b1/c-host/platform/Windows/include/windows/mousehook.h Examining data/looking-glass-0+b1/c-host/platform/Windows/include/windows/platform.h Examining data/looking-glass-0+b1/c-host/platform/Windows/src/mousehook.c Examining data/looking-glass-0+b1/c-host/platform/Windows/src/platform.c Examining data/looking-glass-0+b1/c-host/platform/Windows/src/platform.h Examining data/looking-glass-0+b1/c-host/platform/Windows/src/windebug.c Examining data/looking-glass-0+b1/c-host/src/app.c Examining data/looking-glass-0+b1/client/clipboards/X11/src/x11.c Examining data/looking-glass-0+b1/client/decoders/src/h264.c Examining data/looking-glass-0+b1/client/decoders/src/null.c Examining data/looking-glass-0+b1/client/decoders/src/yuv420.c Examining data/looking-glass-0+b1/client/fonts/SDL/src/sdl.c Examining data/looking-glass-0+b1/client/include/interface/app.h Examining data/looking-glass-0+b1/client/include/interface/clipboard.h Examining data/looking-glass-0+b1/client/include/interface/decoder.h Examining data/looking-glass-0+b1/client/include/interface/font.h Examining data/looking-glass-0+b1/client/include/interface/renderer.h Examining data/looking-glass-0+b1/client/include/lg-decoders.h Examining data/looking-glass-0+b1/client/include/ll.h Examining data/looking-glass-0+b1/client/include/utils.h Examining data/looking-glass-0+b1/client/parsers/nal.c Examining data/looking-glass-0+b1/client/parsers/nal.h Examining data/looking-glass-0+b1/client/renderers/EGL/alert.c Examining data/looking-glass-0+b1/client/renderers/EGL/alert.h Examining data/looking-glass-0+b1/client/renderers/EGL/cursor.c Examining data/looking-glass-0+b1/client/renderers/EGL/cursor.h Examining data/looking-glass-0+b1/client/renderers/EGL/desktop.c Examining data/looking-glass-0+b1/client/renderers/EGL/desktop.h Examining data/looking-glass-0+b1/client/renderers/EGL/draw.c Examining data/looking-glass-0+b1/client/renderers/EGL/draw.h Examining data/looking-glass-0+b1/client/renderers/EGL/egl.c Examining data/looking-glass-0+b1/client/renderers/EGL/fps.c Examining data/looking-glass-0+b1/client/renderers/EGL/fps.h Examining data/looking-glass-0+b1/client/renderers/EGL/model.c Examining data/looking-glass-0+b1/client/renderers/EGL/model.h Examining data/looking-glass-0+b1/client/renderers/EGL/shader.c Examining data/looking-glass-0+b1/client/renderers/EGL/shader.h Examining data/looking-glass-0+b1/client/renderers/EGL/splash.c Examining data/looking-glass-0+b1/client/renderers/EGL/splash.h Examining data/looking-glass-0+b1/client/renderers/EGL/texture.c Examining data/looking-glass-0+b1/client/renderers/EGL/texture.h Examining data/looking-glass-0+b1/client/renderers/OpenGL/opengl.c Examining data/looking-glass-0+b1/client/spice/include/messages.h Examining data/looking-glass-0+b1/client/spice/include/rsa.h Examining data/looking-glass-0+b1/client/spice/include/spice.h Examining data/looking-glass-0+b1/client/spice/src/rsa.c Examining data/looking-glass-0+b1/client/spice/src/spice.c Examining data/looking-glass-0+b1/client/src/app.c Examining data/looking-glass-0+b1/client/src/config.c Examining data/looking-glass-0+b1/client/src/config.h Examining data/looking-glass-0+b1/client/src/kb.h Examining data/looking-glass-0+b1/client/src/lg-renderer.c Examining data/looking-glass-0+b1/client/src/ll.c Examining data/looking-glass-0+b1/client/src/main.c Examining data/looking-glass-0+b1/client/src/main.h Examining data/looking-glass-0+b1/client/src/utils.c Examining data/looking-glass-0+b1/common/include/common/KVMFR.h Examining data/looking-glass-0+b1/common/include/common/crash.h Examining data/looking-glass-0+b1/common/include/common/debug.h Examining data/looking-glass-0+b1/common/include/common/locking.h Examining data/looking-glass-0+b1/common/include/common/memcpySSE.h Examining data/looking-glass-0+b1/common/include/common/option.h Examining data/looking-glass-0+b1/common/include/common/stringlist.h Examining data/looking-glass-0+b1/common/include/common/stringutils.h Examining data/looking-glass-0+b1/common/include/common/sysinfo.h Examining data/looking-glass-0+b1/common/src/bfd.inc.h Examining data/looking-glass-0+b1/common/src/crash.linux.c Examining data/looking-glass-0+b1/common/src/crash.windows.c Examining data/looking-glass-0+b1/common/src/option.c Examining data/looking-glass-0+b1/common/src/stringlist.c Examining data/looking-glass-0+b1/common/src/stringutils.c Examining data/looking-glass-0+b1/common/src/sysinfo.linux.c Examining data/looking-glass-0+b1/common/src/sysinfo.windows.c Examining data/looking-glass-0+b1/module/kvmfr.c Examining data/looking-glass-0+b1/vendor/getopt/getopt.c Examining data/looking-glass-0+b1/vendor/getopt/getopt.h Examining data/looking-glass-0+b1/vendor/ivshmem/ivshmem.h FINAL RESULTS: data/looking-glass-0+b1/c-host/platform/Linux/src/platform.c:66:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "/sys/class/uio/%s/%s", shmDevice, file); data/looking-glass-0+b1/c-host/platform/Linux/src/platform.c:109:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "/dev/%s", shmDevice); data/looking-glass-0+b1/c-host/platform/Windows/src/platform.c:108:13: [4] (shell) ShellExecute: 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. ShellExecute(NULL, NULL, logFile, NULL, NULL, SW_SHOWNORMAL); data/looking-glass-0+b1/c-host/platform/Windows/src/platform.c:167:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(logFilePath, "%slooking-glass-host.txt", tempPath); data/looking-glass-0+b1/client/src/app.c:31:22: [4] (format) vsnprintf: 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. const int length = vsnprintf(NULL, 0, fmt, args); data/looking-glass-0+b1/client/src/app.c:36:3: [4] (format) vsnprintf: 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. vsnprintf(buffer, length + 1, fmt, args); data/looking-glass-0+b1/common/include/common/debug.h:50:41: [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. #define DEBUG_PRINT(type, fmt, ...) do {fprintf(stderr, type " %20s:%-4u | %-30s | " fmt "\n", STRIPPATH(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__);} while (0) data/looking-glass-0+b1/common/src/stringutils.c:32:13: [4] (format) vsnprintf: 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. int len = vsnprintf(NULL, 0, format, ap); data/looking-glass-0+b1/common/src/stringutils.c:41:13: [4] (format) vsnprintf: 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. int ret = vsnprintf(*str, len + 1, format, ap); data/looking-glass-0+b1/client/src/main.c:1008: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. char* XDG_SESSION_TYPE = getenv("XDG_SESSION_TYPE"); data/looking-glass-0+b1/client/src/main.c:1016:10: [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("SDL_VIDEODRIVER") == NULL) data/looking-glass-0+b1/common/src/crash.linux.c:213:15: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. crash.exe = realpath(exe, NULL); data/looking-glass-0+b1/vendor/getopt/getopt.c:51: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 nargc, char * const nargv[], const char *ostr) data/looking-glass-0+b1/vendor/getopt/getopt.h:14:7: [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. int getopt(int nargc, char * const nargv[], const char *ostr); data/looking-glass-0+b1/c-host/platform/Linux/capture/XCB/src/xcb.c:218: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(frame->data, this->data, this->width * this->height * 4); data/looking-glass-0+b1/c-host/platform/Linux/src/platform.c:68: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). int fd = open(path, O_RDONLY); data/looking-glass-0+b1/c-host/platform/Linux/src/platform.c:111: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). int fd = open(path, O_RDWR, (mode_t)0600); data/looking-glass-0+b1/c-host/platform/Linux/src/platform.c:212: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 size[32]; data/looking-glass-0+b1/c-host/platform/Windows/capture/DXGI/src/dxgi.c:790: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(frame->data, tex->map.pData, this->pitch * this->height); data/looking-glass-0+b1/c-host/platform/Windows/capture/DXGI/src/dxgi.c:811: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(&p, &this->pointer, sizeof(Pointer)); data/looking-glass-0+b1/c-host/platform/Windows/capture/DXGI/src/dxgi.c:822: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(&this->lastPointer, &p, sizeof(Pointer)); data/looking-glass-0+b1/c-host/platform/Windows/capture/DXGI/src/dxgi_extra.h:645:55: [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. if (format > sizeof(DXGI_FORMAT_STR) / sizeof(const char *)) data/looking-glass-0+b1/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c:118: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 hex[3] = {0}; data/looking-glass-0+b1/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c:121: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(hex, &buffer[i*2], 2); data/looking-glass-0+b1/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c:234: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(&this->grabInfo, &grabInfo, sizeof(grabInfo)); data/looking-glass-0+b1/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c:269: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(frame->data, this->frameBuffer, frame->pitch * frame->height); data/looking-glass-0+b1/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c:276: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(&events, &this->cursorEvents, sizeof(osEventHandle *) * 2); data/looking-glass-0+b1/c-host/platform/Windows/capture/NVFBC/src/wrapper.cpp:328: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(buffer, params.pBits, params.dwBufferSize); data/looking-glass-0+b1/c-host/platform/Windows/src/platform.c:44: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 executable[MAX_PATH + 1]; data/looking-glass-0+b1/c-host/platform/Windows/src/platform.c:163: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 tempPath[MAX_PATH+1]; data/looking-glass-0+b1/c-host/src/app.c:406: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(app.shmHeader->magic, KVMFR_HEADER_MAGIC, sizeof(KVMFR_HEADER_MAGIC)); data/looking-glass-0+b1/client/decoders/src/h264.c:169: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(&this->format, &format, sizeof(LG_RendererFormat)); data/looking-glass-0+b1/client/decoders/src/h264.c:471: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(&p->CurrPic, &this->curPic, sizeof(VAPictureH264)); data/looking-glass-0+b1/client/decoders/src/h264.c:475: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(&p->ReferenceFrames[0], &this->oldPic, sizeof(VAPictureH264)); data/looking-glass-0+b1/client/decoders/src/h264.c:508: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(m, MatrixBufferH264, sizeof(MatrixBufferH264)); data/looking-glass-0+b1/client/decoders/src/h264.c:645: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(&s->RefPicList0[0], &this->oldPic, sizeof(VAPictureH264)); data/looking-glass-0+b1/client/decoders/src/h264.c:784: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(&this->oldPic, &this->curPic, sizeof(VAPictureH264)); data/looking-glass-0+b1/client/decoders/src/null.c:65: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(&this->format, &format, sizeof(LG_RendererFormat)); data/looking-glass-0+b1/client/decoders/src/yuv420.c:74: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(&this->format, &format, sizeof(LG_RendererFormat)); data/looking-glass-0+b1/client/parsers/nal.c:904:10: [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). fd = fopen("/tmp/stream.h264", "w"); data/looking-glass-0+b1/client/renderers/EGL/cursor.c:178: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(cursor->data, data, size); data/looking-glass-0+b1/client/renderers/EGL/egl.c:163: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(&this->params, ¶ms, sizeof(LG_RendererParams)); data/looking-glass-0+b1/client/renderers/EGL/egl.c:232: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(&this->destRect, &destRect, sizeof(LG_RendererRect)); data/looking-glass-0+b1/client/renderers/EGL/egl.c:311: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(&this->format, &format, sizeof(LG_RendererFormat)); data/looking-glass-0+b1/client/renderers/EGL/fps.c:137: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 str[128]; data/looking-glass-0+b1/client/renderers/EGL/model.c:123: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(fl->v, verticies, sizeof(GLfloat) * count * 3); data/looking-glass-0+b1/client/renderers/EGL/model.c:126: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(fl->u, uvs, sizeof(GLfloat) * count * 2); data/looking-glass-0+b1/client/renderers/EGL/texture.c:256: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(texture->pboMap[texture->pboWIndex], buffer, texture->pboBufferSize); data/looking-glass-0+b1/client/renderers/OpenGL/opengl.c:202: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(&this->params, ¶ms, sizeof(LG_RendererParams)); data/looking-glass-0+b1/client/renderers/OpenGL/opengl.c:299: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(&this->destRect, &destRect, sizeof(LG_RendererRect)); data/looking-glass-0+b1/client/renderers/OpenGL/opengl.c:342: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(this->mouseData, data, size); data/looking-glass-0+b1/client/renderers/OpenGL/opengl.c:389: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(&this->format, &format, sizeof(LG_RendererFormat)); data/looking-glass-0+b1/client/renderers/OpenGL/opengl.c:666: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 str[128]; data/looking-glass-0+b1/client/spice/src/rsa.c:71: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(seed, mask, mask_len); data/looking-glass-0+b1/client/spice/src/rsa.c:111: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(em.all + (key_size - len), message, len); data/looking-glass-0+b1/client/spice/src/spice.c:107: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 password[32]; data/looking-glass-0+b1/client/spice/src/spice.c:405: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 msg[in.message_len+1]; data/looking-glass-0+b1/client/spice/src/spice.c:895: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 buffer[1024]; data/looking-glass-0+b1/client/spice/src/spice.c:1648: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(buffer + 8, data, size); data/looking-glass-0+b1/client/spice/src/spice.c:1655: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(buffer + 4, data, size); data/looking-glass-0+b1/client/src/config.c:485:26: [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. stringlist_push(sl, (char *)LG_Renderers[i]->get_name()); data/looking-glass-0+b1/client/src/config.c:533: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(str, "%dx%d", params.x, params.y); data/looking-glass-0+b1/client/src/config.c:561: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(str, "%dx%d", params.w, params.h); data/looking-glass-0+b1/client/src/main.c:210: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(&header, &state.shm->cursor, sizeof(struct KVMFRCursor)); data/looking-glass-0+b1/client/src/main.c:297: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(&header, &state.shm->frame, sizeof(struct KVMFRFrame)); data/looking-glass-0+b1/client/src/main.c:861:19: [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). state.shmFD = open(params.shmFile, O_RDWR, (mode_t)0600); data/looking-glass-0+b1/client/src/utils.c:28: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). FILE * fh = fopen(filename, "r"); data/looking-glass-0+b1/common/include/common/KVMFR.h:84: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 magic[sizeof(KVMFR_HEADER_MAGIC)]; data/looking-glass-0+b1/common/include/common/memcpySSE.h:30:21: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define memcpySSE memcpy data/looking-glass-0+b1/common/include/common/memcpySSE.h:49: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(dst, src, length); data/looking-glass-0+b1/common/include/common/memcpySSE.h:131: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(dst, src, length & 0xF); data/looking-glass-0+b1/common/include/common/memcpySSE.h:134:21: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define memcpySSE memcpy data/looking-glass-0+b1/common/src/option.c:58:22: [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). opt->value.x_int = atol(str); data/looking-glass-0+b1/common/src/option.c:83: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(ret, "%d", opt->value.x_int); data/looking-glass-0+b1/common/src/option.c:115: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(o, &options[i], sizeof(struct Option)); data/looking-glass-0+b1/common/src/option.c:362: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). FILE * fp = fopen(filename, "r"); data/looking-glass-0+b1/c-host/platform/Linux/src/platform.c:86:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int len = read(fd, name, 31); data/looking-glass-0+b1/c-host/platform/Linux/src/platform.c:213:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int len = read(fd, size, sizeof(size) - 1); data/looking-glass-0+b1/c-host/platform/Windows/capture/DXGI/src/dxgi.c:217:25: [1] (buffer) wcslen: 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). const size_t s = (wcslen(adapterDesc.Description)+1) * 2; data/looking-glass-0+b1/c-host/platform/Windows/capture/DXGI/src/dxgi.c:239:27: [1] (buffer) wcslen: 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). const size_t s = (wcslen(outputDesc.DeviceName)+1) * 2; data/looking-glass-0+b1/c-host/platform/Windows/src/platform.c:196:23: [1] (buffer) wcslen: 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). const size_t s = (wcslen(wargv[i])+1) * 2; data/looking-glass-0+b1/c-host/platform/Windows/src/windebug.c:36: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). for(size_t i = strlen(buffer) - 1; i > 0; --i) data/looking-glass-0+b1/c-host/src/app.c:119:7: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000); data/looking-glass-0+b1/c-host/src/app.c:209:7: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000); data/looking-glass-0+b1/client/renderers/OpenGL/opengl.c:935:28: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. this->texPixels[0] = memalign(pagesize, this->texSize * BUFFER_COUNT); data/looking-glass-0+b1/client/spice/src/rsa.c:149: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(password) + 1, data/looking-glass-0+b1/client/spice/src/rsa.c:209:46: [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). oaep_pad(p, pub.size, (uint8_t *)password, strlen(password)+1); data/looking-glass-0+b1/client/spice/src/spice.c:181:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(spice.password, password, sizeof(spice.password) - 1); data/looking-glass-0+b1/client/spice/src/spice.c:188:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(spice.addr.un.sun_path, host, sizeof(spice.addr.un.sun_path) - 1); data/looking-glass-0+b1/client/spice/src/spice.c:898:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(channel->socket, buffer, sizeof(buffer)); data/looking-glass-0+b1/client/spice/src/spice.c:1302:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t len = read(channel->socket, buf, left); data/looking-glass-0+b1/client/spice/src/spice.c:1324:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size_t len = read(channel->socket, c, left > 8192 ? 8192 : left); data/looking-glass-0+b1/client/src/main.c:178:7: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(params.cursorPollInterval); data/looking-glass-0+b1/client/src/main.c:291:7: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(params.framePollInterval); data/looking-glass-0+b1/client/src/main.c:318:7: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000); data/looking-glass-0+b1/common/src/crash.linux.c:144: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(info->dlpi_name) != 0) data/looking-glass-0+b1/common/src/option.c:183: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 = strlen(o->name); data/looking-glass-0+b1/common/src/option.c:205: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). group->pad = strlen(o->name); data/looking-glass-0+b1/common/src/option.c:259: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 (strlen(argv[a]) != 2) data/looking-glass-0+b1/common/src/option.c:333:15: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for(int c = fgetc(fp); !feof(fp); c = fgetc(fp)) data/looking-glass-0+b1/common/src/option.c:333:41: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for(int c = fgetc(fp); !feof(fp); c = fgetc(fp)) data/looking-glass-0+b1/common/src/option.c:380:15: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for(int c = fgetc(fp); !feof(fp); c = fgetc(fp)) data/looking-glass-0+b1/common/src/option.c:380:41: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for(int c = fgetc(fp); !feof(fp); c = fgetc(fp)) data/looking-glass-0+b1/common/src/option.c:591: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). len = strlen(value); data/looking-glass-0+b1/common/src/option.c:603: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). strlen(state.groups[g].module) + state.groups[g].pad + 1, ANALYSIS SUMMARY: Hits = 105 Lines analyzed = 18956 in approximately 0.47 seconds (39963 lines/second) Physical Source Lines of Code (SLOC) = 14285 Hits@level = [0] 30 [1] 29 [2] 62 [3] 5 [4] 9 [5] 0 Hits@level+ = [0+] 135 [1+] 105 [2+] 76 [3+] 14 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 9.45047 [1+] 7.35037 [2+] 5.32027 [3+] 0.980049 [4+] 0.630032 [5+] 0 Symlinks skipped = 1 (--allowlink overrides but see doc for security issue) 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.