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/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c FINAL RESULTS: data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:45:20: [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(xx) fprintf(errout, xx ) data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:46:21: [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 debug2(xx) fprintf xx data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:47:21: [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 debugr(xx) fprintf(errout, xx ) data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:48:22: [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 debugr2(xx) fprintf xx data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:49:22: [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 debugrr(xx) fprintf(errout, xx ) data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:50:23: [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 debugrr2(xx) fprintf xx data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:282: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(disps[i]->monid, dd.DeviceID); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:286:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%s, at %d, %d, width %d, height %d%s",disps[i]->name+4, data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:465:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%s, at %d, %d, width %d, height %d%s",dp, data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:774:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(desc1,"Monitor %d, Output %s",ndisps+1,outi->name); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:775:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(desc2,"%s at %d, %d, width %d, height %d",desc1, data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:780:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(desc1, "[ Clone of %s ]",outi0->name); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:781:7: [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(desc2, desc1); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1046:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(desc1, "%s",monitor.model); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1052:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(desc2,"%s at %d, %d, width %d, height %d",desc1, data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:190:82: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. pEnumDisplayDevices = (BOOL (WINAPI*)(PVOID,DWORD,PVOID,DWORD)) GetProcAddress(LoadLibrary("USER32"), "EnumDisplayDevicesA"); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:500: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. if ((dname = getenv("DISPLAY")) != NULL) { data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:525:6: [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("ARGYLL_IGNORE_XRANDR1_2") == NULL data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:914:7: [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("ARGYLL_IGNORE_XINERAMA") == NULL data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:70: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 monid[128]; /* Monitor ID */ data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:239: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[200]; data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:376: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[200]; data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:438: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 kbuf[50], vbuf[50]; data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:462:4: [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(desc, "(unknown)"); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:486: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 dnbuf[100]; data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:492: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 desc1[100], desc2[200]; data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:505:5: [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(dnbuf,".0"); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:516:3: [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(dnbuf,":0.0"); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:800:8: [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(pp,".%d",i); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:820:7: [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(desc1, "_ICC_PROFILE"); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:822: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(desc1, "_ICC_PROFILE_%d",disps[ndisps]->uscreen); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:956: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(pp,".%d",0); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:958: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(pp,".%d",i); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:991:5: [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(desc1, "_ICC_PROFILE"); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:993:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(desc1, "_ICC_PROFILE_%d",disps[i]->uscreen); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1000: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 edid_name[50]; data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1008:7: [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(edid_name,"XFree86_DDC_EDID1_RAWDATA"); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1010:7: [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(edid_name,"XFree86_DDC_EDID2_RAWDATA"); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1013: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(edid_name,"XFree86_DDC_EDID1_RAWDATA_%d",disps[i]->uscreen); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1015: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(edid_name,"XFree86_DDC_EDID2_RAWDATA_%d",disps[i]->uscreen); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1048: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(desc1,"Monitor %d",i+1); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1050:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(desc1,"Monitor %d",i+1); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:1229:4: [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(pp,".%d",disp->screen); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:205: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 ((w = malloc(sizeof(unsigned short) * (strlen(s) + 1))) == NULL) data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:270:6: [1] (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 character. strcpy(disps[i]->monid, ""); /* We won't be able to set a profile */ data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:451:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(desc, v, 49); data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:502:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dnbuf,dname,99); dnbuf[99] = '\000'; data/displaycal-3.8.9.3/DisplayCAL/RealDisplaySizeMM.c:508:6: [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(dnbuf,"0"); ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 1413 in approximately 0.22 seconds (6368 lines/second) Physical Source Lines of Code (SLOC) = 1102 Hits@level = [0] 14 [1] 5 [2] 24 [3] 4 [4] 15 [5] 0 Hits@level+ = [0+] 62 [1+] 48 [2+] 43 [3+] 19 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 56.2613 [1+] 43.5572 [2+] 39.02 [3+] 17.2414 [4+] 13.6116 [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.