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/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_document.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_document.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_element_description.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_element_description.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_entity_lookup.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_entity_lookup.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_sax_parser_context.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_sax_parser_context.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_sax_push_parser.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/html_sax_push_parser.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/nokogiri.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/nokogiri.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_attr.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_attr.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_attribute_decl.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_attribute_decl.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_cdata.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_cdata.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_comment.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_comment.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_document.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_document.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_document_fragment.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_document_fragment.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_dtd.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_dtd.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_element_content.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_element_content.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_element_decl.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_element_decl.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_encoding_handler.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_encoding_handler.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_entity_decl.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_entity_decl.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_entity_reference.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_entity_reference.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_io.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_io.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_libxml2_hacks.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_libxml2_hacks.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_namespace.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_namespace.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_node.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_node.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_node_set.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_node_set.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_processing_instruction.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_processing_instruction.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_reader.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_reader.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_relax_ng.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_relax_ng.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_sax_parser.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_sax_parser.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_sax_parser_context.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_sax_parser_context.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_sax_push_parser.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_sax_push_parser.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_schema.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_schema.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_syntax_error.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_syntax_error.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_text.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_text.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_xpath_context.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_xpath_context.h Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xslt_stylesheet.c Examining data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xslt_stylesheet.h FINAL RESULTS: data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/nokogiri.c:22:13: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. int len = vsnprintf (tmp, 1, fmt, ap) + 1; data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/nokogiri.c:27:10: [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. return vsnprintf(res, (unsigned int)len, fmt, ap); data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_reader.c:48:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(key, "%s:%s", XMLNS_PREFIX, ns->prefix); data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_reader.c:50:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(key, "%s", XMLNS_PREFIX); data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/nokogiri.h:101:37: [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. #define NOKOGIRI_DEBUG_START(p) if (getenv("NOKOGIRI_NO_FREE")) return ; if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p start\n", __FILE__, __LINE__, p); data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/nokogiri.h:101:78: [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. #define NOKOGIRI_DEBUG_START(p) if (getenv("NOKOGIRI_NO_FREE")) return ; if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p start\n", __FILE__, __LINE__, p); data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/nokogiri.h:102:35: [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. #define NOKOGIRI_DEBUG_END(p) if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p end\n", __FILE__, __LINE__, p); data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/nokogiri.c:21: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 tmp[1]; data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_io.c:28:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, StringValuePtr(string), safe_len); data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_reader.c:31:10: [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[XMLNS_BUFFER_LEN] ; data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/nokogiri.h:46: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). NOKOGIRI_STR_NEW(str, strlen((const char *)(str))) data/ruby-nokogiri-1.10.9+dfsg/ext/nokogiri/xml_reader.c:40:48: [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). keylen = XMLNS_PREFIX_LEN + (ns->prefix ? (strlen((const char*)ns->prefix) + 1) : 0) ; ANALYSIS SUMMARY: Hits = 12 Lines analyzed = 7974 in approximately 0.20 seconds (39342 lines/second) Physical Source Lines of Code (SLOC) = 4970 Hits@level = [0] 2 [1] 2 [2] 3 [3] 3 [4] 4 [5] 0 Hits@level+ = [0+] 14 [1+] 12 [2+] 10 [3+] 7 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 2.8169 [1+] 2.41449 [2+] 2.01207 [3+] 1.40845 [4+] 0.804829 [5+] 0 Dot directories skipped = 2 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.