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/tidy-html5-5.6.0/console/tab2space.c Examining data/tidy-html5-5.6.0/console/test71.cxx Examining data/tidy-html5-5.6.0/console/tidy.c Examining data/tidy-html5-5.6.0/experimental/TidyNodeIter.c Examining data/tidy-html5-5.6.0/experimental/TidyNodeIter.h Examining data/tidy-html5-5.6.0/experimental/httpio.c Examining data/tidy-html5-5.6.0/experimental/httpio.h Examining data/tidy-html5-5.6.0/include/buffio.h Examining data/tidy-html5-5.6.0/include/platform.h Examining data/tidy-html5-5.6.0/include/tidy.h Examining data/tidy-html5-5.6.0/include/tidybuffio.h Examining data/tidy-html5-5.6.0/include/tidyenum.h Examining data/tidy-html5-5.6.0/include/tidyplatform.h Examining data/tidy-html5-5.6.0/src/access.c Examining data/tidy-html5-5.6.0/src/access.h Examining data/tidy-html5-5.6.0/src/alloc.c Examining data/tidy-html5-5.6.0/src/attrdict.h Examining data/tidy-html5-5.6.0/src/attrs.h Examining data/tidy-html5-5.6.0/src/buffio.c Examining data/tidy-html5-5.6.0/src/charsets.c Examining data/tidy-html5-5.6.0/src/charsets.h Examining data/tidy-html5-5.6.0/src/clean.h Examining data/tidy-html5-5.6.0/src/config.h Examining data/tidy-html5-5.6.0/src/entities.c Examining data/tidy-html5-5.6.0/src/entities.h Examining data/tidy-html5-5.6.0/src/fileio.c Examining data/tidy-html5-5.6.0/src/fileio.h Examining data/tidy-html5-5.6.0/src/forward.h Examining data/tidy-html5-5.6.0/src/gdoc.c Examining data/tidy-html5-5.6.0/src/gdoc.h Examining data/tidy-html5-5.6.0/src/istack.c Examining data/tidy-html5-5.6.0/src/language.h Examining data/tidy-html5-5.6.0/src/lexer.h Examining data/tidy-html5-5.6.0/src/mappedio.c Examining data/tidy-html5-5.6.0/src/mappedio.h Examining data/tidy-html5-5.6.0/src/message.c Examining data/tidy-html5-5.6.0/src/message.h Examining data/tidy-html5-5.6.0/src/messageobj.h Examining data/tidy-html5-5.6.0/src/parser.c Examining data/tidy-html5-5.6.0/src/parser.h Examining data/tidy-html5-5.6.0/src/pprint.h Examining data/tidy-html5-5.6.0/src/sprtf.c Examining data/tidy-html5-5.6.0/src/sprtf.h Examining data/tidy-html5-5.6.0/src/streamio.c Examining data/tidy-html5-5.6.0/src/streamio.h Examining data/tidy-html5-5.6.0/src/tagask.c Examining data/tidy-html5-5.6.0/src/tags.c Examining data/tidy-html5-5.6.0/src/tags.h Examining data/tidy-html5-5.6.0/src/tidy-int.h Examining data/tidy-html5-5.6.0/src/tmbstr.c Examining data/tidy-html5-5.6.0/src/tmbstr.h Examining data/tidy-html5-5.6.0/src/utf8.c Examining data/tidy-html5-5.6.0/src/utf8.h Examining data/tidy-html5-5.6.0/src/version.h Examining data/tidy-html5-5.6.0/src/clean.c Examining data/tidy-html5-5.6.0/src/messageobj.c Examining data/tidy-html5-5.6.0/src/language.c Examining data/tidy-html5-5.6.0/src/language_en_gb.h Examining data/tidy-html5-5.6.0/src/language_es.h Examining data/tidy-html5-5.6.0/src/language_es_mx.h Examining data/tidy-html5-5.6.0/src/language_fr.h Examining data/tidy-html5-5.6.0/src/language_pt_br.h Examining data/tidy-html5-5.6.0/src/language_zh_cn.h Examining data/tidy-html5-5.6.0/src/language_en.h Examining data/tidy-html5-5.6.0/src/attrdict.c Examining data/tidy-html5-5.6.0/src/lexer.c Examining data/tidy-html5-5.6.0/src/config.c Examining data/tidy-html5-5.6.0/src/tidylib.c Examining data/tidy-html5-5.6.0/src/pprint.c Examining data/tidy-html5-5.6.0/src/attrs.c FINAL RESULTS: data/tidy-html5-5.6.0/console/tidy.c:42:13: [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. # define snprintf _snprintf data/tidy-html5-5.6.0/console/tidy.c:42:22: [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. # define snprintf _snprintf data/tidy-html5-5.6.0/console/tidy.c:109:11: [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. len = vsnprintf( result, 0, fmt, argList ); data/tidy-html5-5.6.0/console/tidy.c:116:5: [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( result, len + 1, fmt, argList); data/tidy-html5-5.6.0/console/tidy.c:149:9: [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(sbuf,s); data/tidy-html5-5.6.0/console/tidy.c:199:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(fmt, c1buf[0] !='\0' ? c1buf : ""); data/tidy-html5-5.6.0/console/tidy.c:224:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(fmt, l1, l1, c1buf[0]!='\0'?c1buf:"", data/tidy-html5-5.6.0/console/tidy.c:256:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(fmt, data/tidy-html5-5.6.0/console/tidy.c:273: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( errout, tidyLocalizedString( TC_STRING_UNKNOWN_OPTION ), (char)c ); data/tidy-html5-5.6.0/console/tidy.c:457:13: [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(escpName, aux); data/tidy-html5-5.6.0/console/tidy.c:501: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, tidyLocalizedString(TC_STRING_FATAL_ERROR), (int)id); data/tidy-html5-5.6.0/console/tidy.c:757: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(name, localPos.name1); data/tidy-html5-5.6.0/console/tidy.c:762:9: [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(name, localPos.name2); data/tidy-html5-5.6.0/console/tidy.c:768:9: [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(name, localPos.name3); data/tidy-html5-5.6.0/console/tidy.c:849:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( tidyLocalizedString(TC_TXT_HELP_1), get_final_name(prog), tidyLibraryVersion() ); data/tidy-html5-5.6.0/console/tidy.c:868:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( tidyLocalizedString(TC_TXT_HELP_3), temp_string ); data/tidy-html5-5.6.0/console/tidy.c:871:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( tidyLocalizedString(TC_TXT_HELP_3), "\n" ); data/tidy-html5-5.6.0/console/tidy.c:920:9: [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(val, def); data/tidy-html5-5.6.0/console/tidy.c:936:9: [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(val, d->vals); data/tidy-html5-5.6.0/console/tidy.c:983:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( fmt, data/tidy-html5-5.6.0/console/tidy.c:988:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( fmt, ul, ul, ul ); data/tidy-html5-5.6.0/console/tidy.c:1019:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( tidyLocalizedString( TC_TXT_HELP_ENV_1), subst, env_var ); data/tidy-html5-5.6.0/console/tidy.c:1023:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( tidyLocalizedString( TC_TXT_HELP_ENV_1C ), TIDY_USER_CONFIG_FILE ); data/tidy-html5-5.6.0/console/tidy.c:1358:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( format, winName, posixName ); data/tidy-html5-5.6.0/console/tidy.c:1378:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( format, item ); data/tidy-html5-5.6.0/console/tidy.c:1402:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( tidyLocalizedString(TC_TXT_HELP_LANG_3), tidyGetLanguage() ); data/tidy-html5-5.6.0/console/tidy.c:1441:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( fmt, d->name, d->type, d->def ); data/tidy-html5-5.6.0/console/tidy.c:1458:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(fmt, d->name, d->type, d->def); data/tidy-html5-5.6.0/console/tidy.c:1475:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( fmt, d->name, d->type, d->def ); data/tidy-html5-5.6.0/console/tidy.c:1488:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( fmt, tidyLocalizedString(TC_STRING_CONF_NAME), data/tidy-html5-5.6.0/console/tidy.c:1491:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( fmt, ul, ul, ul ); data/tidy-html5-5.6.0/console/tidy.c:1649:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( tidyLocalizedString( TC_STRING_VERS_A ), tidyPlatform(), tidyLibraryVersion() ); data/tidy-html5-5.6.0/console/tidy.c:1651:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( tidyLocalizedString( TC_STRING_VERS_B ), tidyLibraryVersion() ); data/tidy-html5-5.6.0/console/tidy.c:1679:9: [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, tidyLocalizedString(TC_STRING_OPT_NOT_DOCUMENTED), data/tidy-html5-5.6.0/console/tidy.c:2120:13: [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(errout, tidyLocalizedString( TC_MAIN_ERROR_LOAD_CONFIG ), TIDY_CONFIG_FILE, status); data/tidy-html5-5.6.0/console/tidy.c:2130:13: [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(errout, tidyLocalizedString( TC_MAIN_ERROR_LOAD_CONFIG ), cfgfil, status); data/tidy-html5-5.6.0/console/tidy.c:2139:13: [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(errout, tidyLocalizedString( TC_MAIN_ERROR_LOAD_CONFIG ), TIDY_USER_CONFIG_FILE, status); data/tidy-html5-5.6.0/console/tidy.c:2236:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(tidyLocalizedString(TC_STRING_LANG_NOT_FOUND), data/tidy-html5-5.6.0/console/tidy.c:2524:21: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp_buf,"%s.html",get_log_file()); data/tidy-html5-5.6.0/experimental/httpio.c:130:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( getCmd, "GET /%s HTTP/1.0\r\nAccept: text/html\r\n\r\n", in->pResource ); data/tidy-html5-5.6.0/include/tidyplatform.h:488: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. # define vsnprintf _vsnprintf data/tidy-html5-5.6.0/include/tidyplatform.h:517:11: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. # define access _access data/tidy-html5-5.6.0/src/access.c:396:23: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. tmbstr txt = doc->access.text; data/tidy-html5-5.6.0/src/access.c:406:35: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( x >= sizeof(doc->access.text)-1 ) data/tidy-html5-5.6.0/src/access.c:426:26: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. tmbstr txtnod = doc->access.textNode; data/tidy-html5-5.6.0/src/access.c:442:23: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( doc->access.counter >= TEXTBUF_SIZE-1 ) data/tidy-html5-5.6.0/src/access.c:445:26: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. txtnod[ doc->access.counter++ ] = doc->lexer->lexbuf[i]; data/tidy-html5-5.6.0/src/access.c:465:27: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. TidyClearMemory( doc->access.textNode, TEXTBUF_SIZE ); data/tidy-html5-5.6.0/src/access.c:466:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.counter = 0; data/tidy-html5-5.6.0/src/access.c:469:17: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return doc->access.textNode; data/tidy-html5-5.6.0/src/access.c:480:16: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return doc->access.PRIORITYCHK == 1 || data/tidy-html5-5.6.0/src/access.c:481:16: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.PRIORITYCHK == 2 || data/tidy-html5-5.6.0/src/access.c:482:16: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.PRIORITYCHK == 3; data/tidy-html5-5.6.0/src/access.c:486:17: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return doc->access.PRIORITYCHK == 2 || data/tidy-html5-5.6.0/src/access.c:487:17: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.PRIORITYCHK == 3; data/tidy-html5-5.6.0/src/access.c:491:17: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return doc->access.PRIORITYCHK == 3; data/tidy-html5-5.6.0/src/access.c:813:26: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasUseMap = yes; data/tidy-html5-5.6.0/src/access.c:1122:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.numFrames++; data/tidy-html5-5.6.0/src/access.c:1134:26: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasCheckedLongDesc++; data/tidy-html5-5.6.0/src/access.c:1177:19: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( doc->access.numFrames==3 && doc->access.HasCheckedLongDesc<3 ) data/tidy-html5-5.6.0/src/access.c:1177:47: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( doc->access.numFrames==3 && doc->access.HasCheckedLongDesc<3 ) data/tidy-html5-5.6.0/src/access.c:1179:18: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.numFrames = 0; data/tidy-html5-5.6.0/src/access.c:1433:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.CheckedHeaders++; data/tidy-html5-5.6.0/src/access.c:1440:18: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasTH = yes; data/tidy-html5-5.6.0/src/access.c:1451:14: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasValidRowHeaders = yes; data/tidy-html5-5.6.0/src/access.c:1456:15: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasTH == yes ) data/tidy-html5-5.6.0/src/access.c:1457:14: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasInvalidRowHeader = yes; data/tidy-html5-5.6.0/src/access.c:1474:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.CheckedHeaders++; data/tidy-html5-5.6.0/src/access.c:1479:14: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasTH = yes; data/tidy-html5-5.6.0/src/access.c:1500:14: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasValidColumnHeaders = yes; data/tidy-html5-5.6.0/src/access.c:1503:14: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasInvalidColumnHeader = yes; data/tidy-html5-5.6.0/src/access.c:1762:17: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( ! doc->access.HasValidColumnHeaders ) data/tidy-html5-5.6.0/src/access.c:1809:19: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( doc->access.HasTH ) data/tidy-html5-5.6.0/src/access.c:1817:19: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( doc->access.CheckedHeaders == 2 ) data/tidy-html5-5.6.0/src/access.c:1819:24: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( !doc->access.HasValidRowHeaders && data/tidy-html5-5.6.0/src/access.c:1820:24: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. !doc->access.HasValidColumnHeaders && data/tidy-html5-5.6.0/src/access.c:1821:24: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. !doc->access.HasInvalidRowHeader && data/tidy-html5-5.6.0/src/access.c:1822:24: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. !doc->access.HasInvalidColumnHeader ) data/tidy-html5-5.6.0/src/access.c:1827:24: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( !doc->access.HasValidRowHeaders && data/tidy-html5-5.6.0/src/access.c:1828:23: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasInvalidRowHeader ) data/tidy-html5-5.6.0/src/access.c:1833:24: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( !doc->access.HasValidColumnHeaders && data/tidy-html5-5.6.0/src/access.c:1834:23: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasInvalidColumnHeader ) data/tidy-html5-5.6.0/src/access.c:1985:16: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( !doc->access.HasValidFor && data/tidy-html5-5.6.0/src/access.c:1986:15: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasValidId ) data/tidy-html5-5.6.0/src/access.c:1991:16: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( !doc->access.HasValidId && data/tidy-html5-5.6.0/src/access.c:1992:15: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasValidFor ) data/tidy-html5-5.6.0/src/access.c:1997:16: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( !doc->access.HasValidId && data/tidy-html5-5.6.0/src/access.c:1998:16: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. !doc->access.HasValidFor ) data/tidy-html5-5.6.0/src/access.c:2018:18: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasValidFor = yes; data/tidy-html5-5.6.0/src/access.c:2020:21: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( ++doc->access.ForID == 2 ) data/tidy-html5-5.6.0/src/access.c:2022:18: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.ForID = 0; data/tidy-html5-5.6.0/src/access.c:2049:22: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.HasValidId = yes; data/tidy-html5-5.6.0/src/access.c:2052:21: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( ++doc->access.ForID == 2 ) data/tidy-html5-5.6.0/src/access.c:2054:18: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.ForID = 0; data/tidy-html5-5.6.0/src/access.c:2912:14: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.ListElements++; data/tidy-html5-5.6.0/src/access.c:2916:14: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.OtherListElements++; data/tidy-html5-5.6.0/src/access.c:2992:28: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. TidyClearMemory( &doc->access, sizeof(doc->access) ); data/tidy-html5-5.6.0/src/access.c:2992:48: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. TidyClearMemory( &doc->access, sizeof(doc->access) ); data/tidy-html5-5.6.0/src/access.c:2993:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. doc->access.PRIORITYCHK = level123; data/tidy-html5-5.6.0/src/config.c:926:19: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. Bool exists = ( access(fname, 0) == 0 ); data/tidy-html5-5.6.0/src/lexer.c:390:13: [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(buf,pv2s->val); data/tidy-html5-5.6.0/src/sprtf.c:131: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(logfile,def_log); data/tidy-html5-5.6.0/src/sprtf.c:160: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(logfile,def_log); data/tidy-html5-5.6.0/src/sprtf.c:169: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(logfile,def_log); data/tidy-html5-5.6.0/src/sprtf.c:172: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(logfile,nf); /* set new name */ data/tidy-html5-5.6.0/src/sprtf.c:273:21: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. len = sprintf( tb, "%s - %s", get_date_time_stg(), ps ); data/tidy-html5-5.6.0/src/sprtf.c:277:21: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. len = sprintf( tb, "%s - %s", get_time_stg(), ps ); data/tidy-html5-5.6.0/src/sprtf.c:374:8: [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. i = vsnprintf( pb, M_MAX_SPRTF, pf, arglist ); data/tidy-html5-5.6.0/src/tidy-int.h:47:29: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. TidyAccessImpl access; data/tidy-html5-5.6.0/src/tmbstr.c:231:14: [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. retval = vsnprintf(buffer, count - 1, format, args); data/tidy-html5-5.6.0/src/tmbstr.c:235:14: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. retval = vsprintf(buffer, format, args); data/tidy-html5-5.6.0/src/tmbstr.h:73:23: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((format(printf, 3, 0))) data/tidy-html5-5.6.0/src/tmbstr.h:78:23: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__((format(printf, 3, 4))) data/tidy-html5-5.6.0/console/tidy.c:1009:21: [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. Bool uses_env = getenv("HTML_TIDY") != NULL; data/tidy-html5-5.6.0/console/tidy.c:1010:34: [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. ctmbstr env_var = uses_env ? getenv("HTML_TIDY"): tidyLocalizedString( TC_TXT_HELP_ENV_1B ); data/tidy-html5-5.6.0/console/tidy.c:2126:20: [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 ( (cfgfil = getenv("HTML_TIDY")) != NULL ) data/tidy-html5-5.6.0/src/config.c:877:20: [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. home_dir = getenv("HOME"); data/tidy-html5-5.6.0/console/tab2space.c:307:19: [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). fin = fopen(infile, "rb"); data/tidy-html5-5.6.0/console/tab2space.c:336:23: [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). fout = fopen(outfile, "wb"); data/tidy-html5-5.6.0/console/tidy.c:420: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 aux[2]; data/tidy-html5-5.6.0/console/tidy.c:447:13: [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(escpName, "<"); data/tidy-html5-5.6.0/console/tidy.c:450:13: [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(escpName, ">"); data/tidy-html5-5.6.0/console/tidy.c:453:13: [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(escpName, """); data/tidy-html5-5.6.0/console/tidy.c:601:21: [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(d->tempdefs, "%u", idef); data/tidy-html5-5.6.0/console/tidy.c:761:9: [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(name, ", "); data/tidy-html5-5.6.0/console/tidy.c:767:9: [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(name, ", "); data/tidy-html5-5.6.0/console/tidy.c:918:13: [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(val, ", "); data/tidy-html5-5.6.0/console/tidy.c:1712: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[sizeBuffer]; data/tidy-html5-5.6.0/console/tidy.c:2523:28: [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 tmp_buf[264]; data/tidy-html5-5.6.0/experimental/httpio.c:17: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 (&sock.sin_addr, pHost->h_addr, pHost->h_length); data/tidy-html5-5.6.0/experimental/httpio.h:28: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/tidy-html5-5.6.0/experimental/httpio.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 unGetBuffer[16]; data/tidy-html5-5.6.0/src/access.c:773:33: [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). int width = atoi( av->value ); data/tidy-html5-5.6.0/src/access.c:792:38: [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). if ( hasValue(av) && atoi(av->value) < 30 ) data/tidy-html5-5.6.0/src/access.c:1621:50: [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). && (atoi(av->value) > 1) ) data/tidy-html5-5.6.0/src/access.c:1625:50: [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). && (atoi(av->value) > 1) ) data/tidy-html5-5.6.0/src/attrs.c:1493:32: [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. pos += sprintf( dest + pos, "%%%02X", (byte)c ); data/tidy-html5-5.6.0/src/attrs.c:1497:28: [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. pos += sprintf( dest + pos, "%%%02X", (byte)c ); data/tidy-html5-5.6.0/src/buffio.c:171: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( buf->bp + buf->size, vp, size ); data/tidy-html5-5.6.0/src/config.c:893:13: [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(t, filename+1, s-filename-1); data/tidy-html5-5.6.0/src/config.c:930: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* fin = fopen(fname, "r"); data/tidy-html5-5.6.0/src/config.c:954:17: [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* fin = fopen( fname, "r" ); data/tidy-html5-5.6.0/src/config.c:1111:13: [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[sizeBuf]; data/tidy-html5-5.6.0/src/config.c:1455: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 buf[256] = {0}; data/tidy-html5-5.6.0/src/config.c:1946:18: [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* fout = fopen( cfgfil, "wb" ); data/tidy-html5-5.6.0/src/language.c:311: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 result[6] = "xx_yy"; data/tidy-html5-5.6.0/src/language.c:401: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 lang[3] = ""; data/tidy-html5-5.6.0/src/lexer.c:49: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[(MX_TXT*4)+8]; /* NOTE extra for '...'\0 tail */ data/tidy-html5-5.6.0/src/lexer.c:400:13: [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(buf,"----"); data/tidy-html5-5.6.0/src/lexer.c:409:9: [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(EndBuf(buf),"%u",vers); data/tidy-html5-5.6.0/src/lexer.c:419: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 vcur[256]; data/tidy-html5-5.6.0/src/message.c:535: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 tagdesc[64]; data/tidy-html5-5.6.0/src/message.c:614: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 buf[ 32 ] = {'\0'}; data/tidy-html5-5.6.0/src/message.c:671: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 nodedesc[ 256 ] = {0}; data/tidy-html5-5.6.0/src/message.c:672: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 elemdesc[ 256 ] = {0}; data/tidy-html5-5.6.0/src/message.c:867: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 nodedesc[ 256 ] = {0}; data/tidy-html5-5.6.0/src/messageobj.c:33: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 format[FORMAT_LENGTH]; /* buffer for the format */ data/tidy-html5-5.6.0/src/sprtf.c:49: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 _s_strbufs[MX_ONE_BUF * MX_BUFFERS]; data/tidy-html5-5.6.0/src/sprtf.c:63: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 logfile[264] = "\0"; data/tidy-html5-5.6.0/src/sprtf.c:139: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). outfile = fopen(logfile, mode); data/tidy-html5-5.6.0/src/sprtf.c:166:37: [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). void set_log_file( char * nf, int open ) data/tidy-html5-5.6.0/src/sprtf.c:175:18: [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). } else if (open) { data/tidy-html5-5.6.0/src/sprtf.c:312: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 _s_buf[1024]; data/tidy-html5-5.6.0/src/sprtf.c:369:11: [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 _s_sprtfbuf[M_MAX_SPRTF+4]; data/tidy-html5-5.6.0/src/sprtf.c:388:11: [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 _s_woibuf[1024]; data/tidy-html5-5.6.0/src/sprtf.h:71:47: [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). TIDY_EXPORT void set_log_file( char * nf, int open ); data/tidy-html5-5.6.0/src/streamio.c:136: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( &in->source, source, sizeof(TidyInputSource) ); data/tidy-html5-5.6.0/src/streamio.c:493: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( &out->sink, sink, sizeof(TidyOutputSink) ); data/tidy-html5-5.6.0/src/tidylib.c:945:24: [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* errout = fopen( errfilnam, "wb" ); data/tidy-html5-5.6.0/src/tidylib.c:1121:17: [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* fin = fopen( filnam, "r+" ); data/tidy-html5-5.6.0/src/tidylib.c:1135:11: [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). fin = fopen( filnam, "rb" ); data/tidy-html5-5.6.0/src/tidylib.c:1256:16: [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). fout = fopen( filnam, "wb" ); data/tidy-html5-5.6.0/src/tidylib.c:1355: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( buffer, outbuf.bp, outbuf.size ); data/tidy-html5-5.6.0/console/tab2space.c:150:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(in->fp); data/tidy-html5-5.6.0/console/tab2space.c:159:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(in->fp); data/tidy-html5-5.6.0/console/test71.cxx:28: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). tidyBufAppend(&buff, (void *)sample, strlen(sample)); data/tidy-html5-5.6.0/console/tidy.c:147: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). else if (strlen(s) <= offset) data/tidy-html5-5.6.0/console/tidy.c:178:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sbuf,s,l); data/tidy-html5-5.6.0/console/tidy.c:749: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(localPos.name1); data/tidy-html5-5.6.0/console/tidy.c:751: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). len += 2+strlen(localPos.name2); data/tidy-html5-5.6.0/console/tidy.c:753: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). len += 2+strlen(localPos.name3); data/tidy-html5-5.6.0/console/tidy.c:784: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). size_t len = strlen(prog); data/tidy-html5-5.6.0/console/tidy.c:811: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). size_t len = width < strlen(name) ? width : strlen(name); data/tidy-html5-5.6.0/console/tidy.c:811:53: [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). size_t len = width < strlen(name) ? width : strlen(name); data/tidy-html5-5.6.0/console/tidy.c:857:21: [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). width = width < strlen(temp_string) ? width : strlen(temp_string); data/tidy-html5-5.6.0/console/tidy.c:857:51: [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). width = width < strlen(temp_string) ? width : strlen(temp_string); data/tidy-html5-5.6.0/console/tidy.c:906:16: [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(def); data/tidy-html5-5.6.0/console/tidy.c:934:39: [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). tmbstr val = (tmbstr)malloc(1+strlen(d->vals)); data/tidy-html5-5.6.0/console/tidy.c:1152: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). if ( !description || (strlen(description) < 1) ) data/tidy-html5-5.6.0/console/tidy.c:1205:25: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name + i_name, &c, 1); data/tidy-html5-5.6.0/console/tidy.c:1242: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). writer_len = strlen( writer ); data/tidy-html5-5.6.0/console/tidy.c:1263:29: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( result + i_result, writer, writer_len ); data/tidy-html5-5.6.0/console/tidy.c:1525:36: [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). tidyBufAppend(dst, cp, strlen(cp)); data/tidy-html5-5.6.0/console/tidy.c:1530:28: [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). tidyBufAppend(dst, in, strlen(in)); data/tidy-html5-5.6.0/console/tidy.c:1565:54: [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). tidyBufAppend(&buf1, d->def, strlen(d->def)); data/tidy-html5-5.6.0/console/tidy.c:1592:54: [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). tidyBufAppend(&buf1, d->def, strlen(d->def)); data/tidy-html5-5.6.0/console/tidy.c:1717:63: [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 ( pos->eqconfig && (strncmp(buffer, pos->eqconfig, strlen(buffer)) == 0) ) data/tidy-html5-5.6.0/experimental/httpio.c:129:39: [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). char *getCmd = MemAlloc( 48 + strlen( in->pResource )); data/tidy-html5-5.6.0/experimental/httpio.c:131: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). send( in->s, getCmd, strlen( getCmd ), 0 ); data/tidy-html5-5.6.0/src/fileio.c:31:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bv = fgetc( fin->fp ); data/tidy-html5-5.6.0/src/language.c:333: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( search ); data/tidy-html5-5.6.0/src/language.c:415: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 ( strlen( wantCode ) > 2 ) data/tidy-html5-5.6.0/src/language.c:417:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(lang, wantCode, 2); data/tidy-html5-5.6.0/src/lexer.c:345: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). # define EndBuf(a) ( a + strlen(a) ) data/tidy-html5-5.6.0/src/lexer.c:383:20: [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 = (int)strlen(buf); data/tidy-html5-5.6.0/src/lexer.c:387:17: [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(buf,"|"); data/tidy-html5-5.6.0/src/lexer.c:391:25: [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 += (int)strlen(pv2s->val); data/tidy-html5-5.6.0/src/lexer.c:397:17: [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(buf,"|"); data/tidy-html5-5.6.0/src/lexer.c:408:13: [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(buf,"|"); data/tidy-html5-5.6.0/src/messageobj.c:638:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(nas[cn].format, fmt + nas[cn].formatStart, nas[cn].formatLength); data/tidy-html5-5.6.0/src/sprtf.c:251:5: [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(ps," "); data/tidy-html5-5.6.0/src/sprtf.c:263: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 = (int)strlen(ps); data/tidy-html5-5.6.0/src/sprtf.c:316: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). i = strlen(ps); data/tidy-html5-5.6.0/src/sprtf.c:362: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). return (int)strlen(cp); data/tidy-html5-5.6.0/src/sprtf.h:80: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). #define EndBuf(a) ( a + strlen(a) ) ANALYSIS SUMMARY: Hits = 215 Lines analyzed = 56984 in approximately 1.68 seconds (33921 lines/second) Physical Source Lines of Code (SLOC) = 40519 Hits@level = [0] 138 [1] 42 [2] 56 [3] 4 [4] 113 [5] 0 Hits@level+ = [0+] 353 [1+] 215 [2+] 173 [3+] 117 [4+] 113 [5+] 0 Hits/KSLOC@level+ = [0+] 8.71196 [1+] 5.30615 [2+] 4.2696 [3+] 2.88753 [4+] 2.78882 [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.