Flawfinder version 1.27, (C) 2001-2004 David A. Wheeler. Number of dangerous functions in C/C++ ruleset: 160 Examining AnnotationList.c Examining assoc.c Examining closure.c Examining complain.c Examining conflicts.c Examining derives.c Examining files.c Examining getargs.c Examining gram.c Examining graphviz.c Examining ielr.c Examining InadequacyList.c Examining lalr.c Examining location.c Examining LR0.c Examining main.c Examining muscle-tab.c Examining named-ref.c Examining nullable.c Examining output.c Examining parse-gram.c Examining print.c Examining print_graph.c Examining print-xml.c Examining reader.c Examining reduce.c Examining relation.c Examining Sbitset.c Examining scan-code.c Examining scan-code-c.c Examining scan-gram.c Examining scan-gram-c.c Examining scan-skel.c Examining scan-skel-c.c Examining state.c Examining symlist.c Examining symtab.c Examining tables.c Examining uniqstr.c Sbitset.c:77: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited. Use a constant for the format specification. fprintf (file, " %" SBITSET__INDEX__CONVERSION_SPEC, i); complain.c:74: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited. Use a constant for the format specification. vfprintf (stderr, message, args); output.c:594: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). strcpy (full_skeleton + pkgdatadirlen + 1, m4sugar); output.c:596: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). strcpy (full_skeleton + pkgdatadirlen + 1, m4bison); output.c:599: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). strcpy (full_skeleton, skeleton); output.c:601: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). strcpy (full_skeleton + pkgdatadirlen + 1, skeleton); parse-gram.c:983: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited. Use a constant for the format specification. # define YYFPRINTF fprintf parse-gram.c:2441: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). strcpy (skeleton_build + dir_length, skeleton_user); print-xml.c:450: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited. Use a constant for the format specification. vfprintf (out, fmt, arglist); symlist.c:124: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited. Use a constant for the format specification. fprintf (stderr, l->action_props.is_value_used ? " used" : " unused"); uniqstr.c:63: [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. Use a constant for the format specification. length = vsnprintf (NULL, 0, format, args); uniqstr.c:68: [4] (format) vsprintf: Potential format string problem. Make format string constant. vsprintf (res, format, args); getargs.c:547: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows . Check implementation on installation, or limit the size of all string inputs. while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) main.c:68: [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. Check environment variables carefully before using them. char const *cp = getenv ("LC_CTYPE"); output.c:583: [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. Check environment variables carefully before using them. char const *m4 = (p = getenv ("M4")) ? p : M4; output.c:688: [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. Check environment variables carefully before using them. char const *use_push_for_pull_env = getenv ("BISON_USE_PUSH_FOR_PULL"); output.c:763: [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. Check environment variables carefully before using them. char const *pkgdatadir = getenv ("BISON_PKGDATADIR"); ielr.c:275: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. memcpy ((*edgesp)[i] + edge_counts[i], edge_array + edge_counts[i], lalr.c:190: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. memcpy (reads[i], edge, nedges * sizeof edge[0]); location.c:149: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range. 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). bound->column = atoi (delim+1); location.c:153: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range. 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). bound->line = atoi (delim+1); muscle-tab.c:439: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range. 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 (muscle_find_const (how_name)); output.c:573: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char const *argv[10]; parse-gram.c:1714: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; parse-gram.c:1971: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char yymsgbuf[128]; parse-gram.c:3370: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char const alphanum[26 + 26 + 1 + 10] = parse-gram.c:3408: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. memcpy (name, name_start, name_len); parse-gram.c:3451: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[4]; print.c:403: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[90]; print.c:421: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buffer, " (%d)", i); print.c:428: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buffer + strlen (buffer), " %d", r); print.c:459: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buffer, " (%d)", i); print.c:465: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buffer + strlen (buffer), _(" on left:")); print.c:472: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buffer + strlen (buffer), " %d", r); print.c:482: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buffer + strlen (buffer), _(" on right:")); print.c:490: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buffer + strlen (buffer), " %d", r); scan-code.c:2628: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char at_buf[20]; scan-code.c:2630: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination. Consider using strncpy or strlcpy (warning, strncpy is easily misused). Risk is low because the source is a constant string. strcpy (at_buf, "$$"); scan-skel.c:908: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX]; state.c:46: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. memcpy (res->states, the_states, states_size); state.c:84: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. memcpy (res->symbols, tokens, symbols_size); state.c:107: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. memcpy (res->rules, reds, rules_size); state.c:150: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. memcpy (res->items, core, items_size); state.c:178: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. memcpy (res->items, s->items, items_size); state.c:399: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination. Make sure destination can always hold the source data. memcpy (probe->items, core, items_size); symtab.c:152: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char const alphanum[26 + 26 + 1 + 10] = symtab.c:769: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[256]; symtab.c:773: [2] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "address@hidden", ++dummy_count); uniqstr.c:66: [2] (buffer) char: Statically-sized arrays can be overflowed. Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char res[length + 1]; complain.c:76: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). size_t l = strlen (message); files.c:93: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). size_t len = strlen (str1) + strlen (str2); files.c:93: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). size_t len = strlen (str1) + strlen (str2); files.c:244: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). (strlen (spec_outfile) - (ext ? strlen (ext) : 0))); files.c:244: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). (strlen (spec_outfile) - (ext ? strlen (ext) : 0))); files.c:249: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). (strlen (spec_outfile) files.c:250: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). - (tab ? strlen (tab) : (ext ? strlen (ext) : 0)))); files.c:250: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). - (tab ? strlen (tab) : (ext ? strlen (ext) : 0)))); files.c:279: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0))); files.c:279: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0))); gram.c:78: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). for (n = strlen (previous_lhs->tag); n > 0; --n) output.c:169: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). int width = strlen (cp) + 2; output.c:585: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). size_t skeleton_size = strlen (skeleton) + 1; output.c:586: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). size_t pkgdatadirlen = strlen (pkgdatadir); output.c:592: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers. strncpy (full_skeleton, pkgdatadir, pkgdatadirlen); parse-gram.c:1595: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). # define yystrlen strlen parse-gram.c:2428: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). size_t dir_length = strlen (current_file); parse-gram.c:2435: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). xmalloc (dir_length + 1 + strlen (skeleton_user) + 1); parse-gram.c:2438: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers. strncpy (skeleton_build, current_file, dir_length); parse-gram.c:3019: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). (yyvsp[0].code)[strlen ((yyvsp[0].code)) - 1] = '\n'; print-xml.c:459: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). size_t len = strlen (str); print.c:60: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). size_t len = strlen (str); print.c:161: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). for (j = width - strlen (tag); j > 0; --j) print.c:201: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). for (j = width - strlen (tag); j > 0; --j) print.c:221: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). for (j = width - strlen (lookahead_token); j > 0; --j) print.c:264: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). width = strlen (_("$default")); print.c:390: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). if (column + strlen (buffer) > (End)) \ print.c:418: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). column = strlen (tag); print.c:428: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). sprintf (buffer + strlen (buffer), " %d", r); print.c:458: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). column = strlen (tag); print.c:465: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). sprintf (buffer + strlen (buffer), _(" on left:")); print.c:472: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). sprintf (buffer + strlen (buffer), " %d", r); print.c:480: [1] (buffer) sprintf: Does not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because the source is a constant character. sprintf (buffer + strlen (buffer), ","); print.c:480: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). sprintf (buffer + strlen (buffer), ","); print.c:482: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). sprintf (buffer + strlen (buffer), _(" on right:")); print.c:490: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). sprintf (buffer + strlen (buffer), " %d", r); scan-code.c:871: [1] (buffer) getc: Check buffer boundaries if used in a loop. (c = getc( code_in )) != EOF && c != '\n'; ++n ) \ scan-code.c:2235: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). return code__scan_bytes(yystr,strlen(yystr) ); scan-code.c:2632: [1] (port) snprintf: On some very old systems, snprintf is incorrectly implemented and permits buffer overflows; there are also incompatible standard definitions of it. Check it during installation, or use something else. snprintf (at_buf, sizeof at_buf, "$%u", symbol_index); scan-code.c:2661: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). cp + strlen (var->id); scan-gram.c:1208: [1] (buffer) getc: Check buffer boundaries if used in a loop. (c = getc( gram_in )) != EOF && c != '\n'; ++n ) \ scan-gram.c:3361: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). return gram__scan_bytes(yystr,strlen(yystr) ); scan-gram.c:3665: [1] (buffer) getc: Check buffer boundaries if used in a loop. int ch = getc (fp); scan-skel.c:791: [1] (buffer) getc: Check buffer boundaries if used in a loop. (c = getc( skel_in )) != EOF && c != '\n'; ++n ) \ scan-skel.c:2002: [1] (buffer) strlen: Does not handle strings that are not \0-terminated (it could cause a crash if unprotected). return skel__scan_bytes(yystr,strlen(yystr) ); Hits = 94 Lines analyzed = 26173 in 1.14 seconds (40704 lines/second) Physical Source Lines of Code (SLOC) = 16927 address@hidden = [0] 0 [1] 45 [2] 32 [3] 5 [4] 12 [5] 0 address@hidden = [0+] 94 [1+] 94 [2+] 49 [3+] 17 [4+] 12 [5+] 0 Hits/address@hidden = [0+] 5.55326 [1+] 5.55326 [2+] 2.89478 [3+] 1.00431 [4+] 0.708927 [5+] 0 Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code!