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/r-cran-cairo-1.5-12.2/src/xlib-backend.c Examining data/r-cran-cairo-1.5-12.2/src/img-backend.c Examining data/r-cran-cairo-1.5-12.2/src/pdf-backend.c Examining data/r-cran-cairo-1.5-12.2/src/img-backend.h Examining data/r-cran-cairo-1.5-12.2/src/cairogd.h Examining data/r-cran-cairo-1.5-12.2/src/cairotalk.c Examining data/r-cran-cairo-1.5-12.2/src/ps-backend.h Examining data/r-cran-cairo-1.5-12.2/src/img-tiff.h Examining data/r-cran-cairo-1.5-12.2/src/cairogd.c Examining data/r-cran-cairo-1.5-12.2/src/cairotalk.h Examining data/r-cran-cairo-1.5-12.2/src/xlib-backend.h Examining data/r-cran-cairo-1.5-12.2/src/img-jpeg.c Examining data/r-cran-cairo-1.5-12.2/src/w32-backend.c Examining data/r-cran-cairo-1.5-12.2/src/Rapi.h Examining data/r-cran-cairo-1.5-12.2/src/img-jpeg.h Examining data/r-cran-cairo-1.5-12.2/src/cairobem.h Examining data/r-cran-cairo-1.5-12.2/src/svg-backend.h Examining data/r-cran-cairo-1.5-12.2/src/pdf-backend.h Examining data/r-cran-cairo-1.5-12.2/src/backend.h Examining data/r-cran-cairo-1.5-12.2/src/ps-backend.c Examining data/r-cran-cairo-1.5-12.2/src/svg-backend.c Examining data/r-cran-cairo-1.5-12.2/src/cairobem.c Examining data/r-cran-cairo-1.5-12.2/src/w32-backend.h Examining data/r-cran-cairo-1.5-12.2/src/img-tiff.c FINAL RESULTS: data/r-cran-cairo-1.5-12.2/src/img-backend.c:78:2: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(fn, l-1, image->filename, pageno); data/r-cran-cairo-1.5-12.2/src/img-backend.c:179: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(image->filename,filename); data/r-cran-cairo-1.5-12.2/src/pdf-backend.c:65:4: [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(fn,filename); data/r-cran-cairo-1.5-12.2/src/ps-backend.c:65:4: [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(fn,filename); data/r-cran-cairo-1.5-12.2/src/svg-backend.c:65:4: [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(fn,filename); data/r-cran-cairo-1.5-12.2/src/w32-backend.c:273:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(fn, d); data/r-cran-cairo-1.5-12.2/src/xlib-backend.c:256:12: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. display=getenv("DISPLAY"); data/r-cran-cairo-1.5-12.2/src/cairobem.c:7: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 *types[64]; data/r-cran-cairo-1.5-12.2/src/cairogd.c:504: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(rc, data+o, l); data/r-cran-cairo-1.5-12.2/src/cairogd.c:522: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(data+o1, rc+o2, l); data/r-cran-cairo-1.5-12.2/src/cairotalk.c:507:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char str[16]; data/r-cran-cairo-1.5-12.2/src/img-jpeg.c:16: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). FILE *output_file = fopen(fn, "wb"); data/r-cran-cairo-1.5-12.2/src/pdf-backend.c:66:4: [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(fn,".pdf"); data/r-cran-cairo-1.5-12.2/src/ps-backend.c:66:4: [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(fn,".ps"); data/r-cran-cairo-1.5-12.2/src/svg-backend.c:66:4: [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(fn,".svg"); data/r-cran-cairo-1.5-12.2/src/w32-backend.c:193:13: [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 *f=fopen("c:\\debug.txt","a"); fprintf(f,"Window: %x: be is NULL!\n", hwnd); fclose(f); } data/r-cran-cairo-1.5-12.2/src/w32-backend.c:200:12: [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 *f=fopen("c:\\debug.txt","a"); fprintf(f,"Window: %x, msg: %x, [%x, %x]\n", (unsigned int)hwnd, (unsigned int)uMsg, (unsigned int)wParam, (unsigned int)lParam); fclose(f); } data/r-cran-cairo-1.5-12.2/src/w32-backend.c:221:14: [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 *f=fopen("c:\\debug.txt","a"); fprintf(f," - WM_SIZE: %d x %d\n", r.right, r.bottom); fclose(f); } data/r-cran-cairo-1.5-12.2/src/w32-backend.c:230:14: [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 *f=fopen("c:\\debug.txt","a"); fprintf(f," - WM_PAINT: %d\n", (int)GetUpdateRect(hwnd,&ur,1)); fclose(f); } data/r-cran-cairo-1.5-12.2/src/w32-backend.c:250:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[128]; data/r-cran-cairo-1.5-12.2/src/w32-backend.c:262:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char mname[127]; data/r-cran-cairo-1.5-12.2/src/w32-backend.c:263:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fn[64]; data/r-cran-cairo-1.5-12.2/src/w32-backend.c:274:2: [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(fn, " Workspace"); data/r-cran-cairo-1.5-12.2/src/w32-backend.c:380:13: [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 *f=fopen("c:\\debug.txt","w"); fprintf(f,"init W32; isMDI=%d, parent=%x\n", isMDI, (unsigned int) parent); fclose(f); } data/r-cran-cairo-1.5-12.2/src/w32-backend.c:462:13: [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 *f=fopen("c:\\debug.txt","a"); fprintf(f,"parent: %x\nMDIclient: %x\ndoc: %x\n", parent, mdiClient, l->w); fclose(f); } data/r-cran-cairo-1.5-12.2/src/cairotalk.c:962: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). int slen = strlen(str); data/r-cran-cairo-1.5-12.2/src/img-backend.c:74: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). int l = strlen(image->filename)+16; data/r-cran-cairo-1.5-12.2/src/img-backend.c:175: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). if ( !(image->filename = malloc(strlen(filename)+1))){ data/r-cran-cairo-1.5-12.2/src/pdf-backend.c:59: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). int len = strlen(filename); data/r-cran-cairo-1.5-12.2/src/ps-backend.c:59: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). int len = strlen(filename); data/r-cran-cairo-1.5-12.2/src/svg-backend.c:59: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). int len = strlen(filename); ANALYSIS SUMMARY: Hits = 31 Lines analyzed = 3810 in approximately 0.12 seconds (32761 lines/second) Physical Source Lines of Code (SLOC) = 3040 Hits@level = [0] 6 [1] 6 [2] 18 [3] 1 [4] 6 [5] 0 Hits@level+ = [0+] 37 [1+] 31 [2+] 25 [3+] 7 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 12.1711 [1+] 10.1974 [2+] 8.22368 [3+] 2.30263 [4+] 1.97368 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.