flawfinder/correct-results.csv

8.8 KiB

1FileLineColumnLevelCategoryNameWarningSuggestionNoteCWEsContext
2test.c3225buffergetsDoes not check for buffer overflows (CWE-120, CWE-20)Use fgets() insteadCWE-120, CWE-20gets(f);
3test.c5635bufferstrncatEasily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120)Consider strcat_s, strlcat, snprintf, or automatically resizing stringsRisk is high; the length parameter appears to be a constant, instead of computing the number of characters left.CWE-120 strncat(d,s,sizeof(d)); /* Misuse - this should be flagged as riskier. */
4test.c5735buffer_tcsncatEasily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120)Consider strcat_s, strlcat, or automatically resizing stringsRisk is high; the length parameter appears to be a constant, instead of computing the number of characters left.CWE-120 _tcsncat(d,s,sizeof(d)); /* Misuse - flag as riskier */
5test.c6035bufferMultiByteToWideCharRequires maximum length in CHARACTERS, not bytes (CWE-120)Risk is high, it appears that the size is given as bytes, but the function requires size as characters.CWE-120 MultiByteToWideChar(CP_ACP,0,szName,-1,wszUserName,sizeof(wszUserName));
6test.c6235bufferMultiByteToWideCharRequires maximum length in CHARACTERS, not bytes (CWE-120)Risk is high, it appears that the size is given as bytes, but the function requires size as characters.CWE-120 MultiByteToWideChar(CP_ACP,0,szName,-1,wszUserName,sizeof wszUserName);
7test.c7335miscSetSecurityDescriptorDaclNever create NULL ACLs; an attacker can set it to Everyone (Deny All Access), which would even forbid administrator access (CWE-732)CWE-732 SetSecurityDescriptorDacl(&sd,TRUE,NULL,FALSE);
8test.c7335miscSetSecurityDescriptorDaclNever create NULL ACLs; an attacker can set it to Everyone (Deny All Access), which would even forbid administrator access (CWE-732)CWE-732 SetSecurityDescriptorDacl(&sd,TRUE,NULL,FALSE);
9test.c1724bufferstrcpyDoes not check for buffer overflows when copying to destination [MS-banned] (CWE-120)Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)CWE-120 strcpy(b, a);
10test.c2024buffersprintfDoes not check for buffer overflows (CWE-120)Use sprintf_s, snprintf, or vsnprintfCWE-120 sprintf(s, "hello %s", bug);
11test.c2124buffersprintfDoes not check for buffer overflows (CWE-120)Use sprintf_s, snprintf, or vsnprintfCWE-120 sprintf(s, gettext("hello %s"), bug);
12test.c2224formatsprintfPotential format string problem (CWE-134)Make format string constantCWE-134 sprintf(s, unknown, bug);
13test.c2324formatprintfIf format strings can be influenced by an attacker, they can be exploited (CWE-134)Use a constant for the format specificationCWE-134 printf(bf, x);
14test.c2524bufferscanfThe 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 functionCWE-120, CWE-20 scanf("%s", s);
15test.c2724bufferscanfThe 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 functionCWE-120, CWE-20 scanf("%s", s);
16test.c3824formatsyslogIf syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134)Use a constant format string for syslogCWE-134 syslog(LOG_ERR, attacker_string);
17test.c4934buffer_mbscpyDoes not check for buffer overflows when copying to destination [MS-banned] (CWE-120)Consider using a function version that stops copying at the end of the bufferCWE-120 _mbscpy(d,s); /* like strcpy, this doesn't check for buffer overflow */
18test.c5234bufferlstrcatDoes not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120)CWE-120 lstrcat(d,s);
19test.c7533shellCreateProcessThis causes a new process to execute and is difficult to use safely (CWE-78)Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to runCWE-78 CreateProcess(NULL, "C:\\Program Files\\GoodGuy\\GoodGuy.exe -x", "");
20test.c7533shellCreateProcessThis causes a new process to execute and is difficult to use safely (CWE-78)Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to runCWE-78 CreateProcess(NULL, "C:\\Program Files\\GoodGuy\\GoodGuy.exe -x", "");
21test.c91203buffergetopt_longSome older implementations do not protect against internal buffer overflows (CWE-120, CWE-20)Check implementation on installation, or limit the size of all string inputsCWE-120, CWE-20 while ((optc = getopt_long (argc, argv, "a",longopts, NULL )) != EOF) {
22test.c1622bufferstrcpyDoes 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.CWE-120 strcpy(a, gettext("Hello there")); // Did this work?
23test.c1922buffersprintfDoes not check for buffer overflows (CWE-120)Use sprintf_s, snprintf, or vsnprintfRisk is low because the source has a constant maximum length.CWE-120 sprintf(s, "hello");
24test.c4532buffercharStatically-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 lengthCWE-119!/CWE-120char d[20];
25test.c4632buffercharStatically-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 lengthCWE-119!/CWE-120char s[20];
26test.c5032buffermemcpyDoes not check for buffer overflows when copying to destination (CWE-120)Make sure destination can always hold the source dataCWE-120 memcpy(d,s);
27test.c5132bufferCopyMemoryDoes not check for buffer overflows when copying to destination (CWE-120)Make sure destination can always hold the source dataCWE-120 CopyMemory(d,s);
28test.c9772miscfopenCheck 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)CWE-362 f = fopen("/etc/passwd", "r");
29test.c1521bufferstrcpyDoes 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.CWE-120 strcpy(a, "\n"); // Did this work?
30test.c1821buffersprintfDoes not check for buffer overflows (CWE-120)Use sprintf_s, snprintf, or vsnprintfRisk is low because the source is a constant character.CWE-120 sprintf(s, "\n");
31test.c2621bufferscanfIt's unclear if the %s limit in the format string is small enough (CWE-120)Check that the limit is sufficiently small, or use a different input functionCWE-120 scanf("%10s", s);
32test.c5331bufferstrncpyEasily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120)CWE-120 strncpy(d,s);
33test.c5431buffer_tcsncpyEasily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120)CWE-120 _tcsncpy(d,s);
34test.c5531bufferstrncatEasily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120)Consider strcat_s, strlcat, snprintf, or automatically resizing stringsCWE-120 strncat(d,s,10);
35test.c5871bufferstrlenDoes 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)CWE-126n = strlen(d);
36test.c6431bufferMultiByteToWideCharRequires maximum length in CHARACTERS, not bytes (CWE-120)Risk is very low, the length appears to be in characters not bytes.CWE-120 MultiByteToWideChar(CP_ACP,0,szName,-1,wszUserName,sizeof(wszUserName)/sizeof(wszUserName[0]));
37test.c6631bufferMultiByteToWideCharRequires maximum length in CHARACTERS, not bytes (CWE-120)Risk is very low, the length appears to be in characters not bytes.CWE-120 MultiByteToWideChar(CP_ACP,0,szName,-1,wszUserName,sizeof wszUserName /sizeof(wszUserName[0]));