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/phabricator-0~git20200925/phabricator/src/infrastructure/diff/__tests__/data/zebra.c Examining data/phabricator-0~git20200925/phabricator/externals/figlet/getopt.c Examining data/phabricator-0~git20200925/phabricator/externals/figlet/inflate.h Examining data/phabricator-0~git20200925/phabricator/externals/figlet/utf8.c Examining data/phabricator-0~git20200925/phabricator/externals/figlet/zipio.c Examining data/phabricator-0~git20200925/phabricator/externals/figlet/crc.c Examining data/phabricator-0~git20200925/phabricator/externals/figlet/crc.h Examining data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c Examining data/phabricator-0~git20200925/phabricator/externals/figlet/utf8.h Examining data/phabricator-0~git20200925/phabricator/externals/figlet/zipio.h Examining data/phabricator-0~git20200925/phabricator/externals/figlet/inflate.c Examining data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c Examining data/phabricator-0~git20200925/arcanist/support/xhpast/xhpast.cpp Examining data/phabricator-0~git20200925/arcanist/support/xhpast/scanner.lex.cpp Examining data/phabricator-0~git20200925/arcanist/support/xhpast/parser.yacc.cpp Examining data/phabricator-0~git20200925/arcanist/support/xhpast/scanner.lex.hpp Examining data/phabricator-0~git20200925/arcanist/support/xhpast/ast.hpp Examining data/phabricator-0~git20200925/arcanist/support/xhpast/parser.yacc.hpp Examining data/phabricator-0~git20200925/arcanist/support/xhpast/astnode.hpp FINAL RESULTS: data/phabricator-0~git20200925/arcanist/support/xhpast/parser.yacc.cpp:3163:21: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define YYFPRINTF fprintf data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:86:3: [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(ucsuffix,suffix); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:148:21: [4] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. #define STRCPY(x,y) wcscpy((x),(y)) data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:149:21: [4] (buffer) wcscat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). #define STRCAT(x,y) wcscat((x),(y)) data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:154:21: [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). #define STRCPY(x,y) strcpy((x),(y)) data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:155:21: [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). #define STRCAT(x,y) strcat((x),(y)) data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:710: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(fontpath,fontdirname); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:713:5: [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(fontpath,name); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:714:5: [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(fontpath,suffix); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:718:3: [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(fontpath,name); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:719:3: [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(fontpath,suffix); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:1153: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(outline,templine); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:927:9: [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. env = getenv("FIGLET_FONTDIR"); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:946:15: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt(Myargc,Myargv,"ADEXLRI:xlcrpntvm:w:d:f:C:NFskSWo"))!= -1) { data/phabricator-0~git20200925/phabricator/externals/figlet/getopt.c:53:5: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt(int argc, char *argv[], char *opts) data/phabricator-0~git20200925/arcanist/support/xhpast/parser.yacc.cpp:3468:7: [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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; data/phabricator-0~git20200925/arcanist/support/xhpast/parser.yacc.cpp:3485:7: [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 yyformat[sizeof yyunexpected data/phabricator-0~git20200925/arcanist/support/xhpast/parser.yacc.cpp:3658: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 yymsgbuf[128]; data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:28:1: [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 posshardblanks[9] = { '!', '@', '#', '$', '%', '&', '*', 0x7f, 0 }; data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:83: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 ucsuffix[10]; data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:217:1: [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 magicnum[5],cha; data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:232:12: [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). fontfile=fopen(fontfilename,"r"); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:263:13: [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). if ((fd = open("/dev/tty",O_WRONLY))<0) return -1; data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:1020:21: [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). infoprint = atoi(optarg); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:1023:21: [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). smushmode = atoi(optarg); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:1034:19: [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). columns = atoi(optarg); data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:1134: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 templine[MAXLEN+1]; data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:1187: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 fileline[MAXLEN+1],magicnum[5]; data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:1554: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 c[10]; data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:1557:3: [2] (buffer) wchar_t: 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. wchar_t wc[2]; data/phabricator-0~git20200925/phabricator/externals/figlet/getopt.c:40: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 errbuf[2];\ data/phabricator-0~git20200925/phabricator/externals/figlet/inflate.c:141: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. unsigned char buffer[BUFFERSIZE]; /* input buffer data */ data/phabricator-0~git20200925/phabricator/externals/figlet/inflate.c:152: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. unsigned char window[WINDOWSIZE]; /* output window data */ data/phabricator-0~git20200925/phabricator/externals/figlet/inflate.c:799: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(is->window + w, is->window + d, e); data/phabricator-0~git20200925/phabricator/externals/figlet/zipio.c:233: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. unsigned char inpbuf[INPBUFSIZE]; /* inp buffer from zip file */ data/phabricator-0~git20200925/phabricator/externals/figlet/zipio.c:234: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. unsigned char *ptrbuf[PTRBUFSIZE]; /* pointers to in-memory bufs */ data/phabricator-0~git20200925/phabricator/externals/figlet/zipio.c:236: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. unsigned char getbuf[OUTBUFSIZE]; /* buffer for use by Zgetc */ data/phabricator-0~git20200925/phabricator/externals/figlet/zipio.c:304:20: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). zs->tmpfil = tmpfile(); data/phabricator-0~git20200925/phabricator/externals/figlet/zipio.c:409:7: [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(tmpbuf, ptr, len); data/phabricator-0~git20200925/phabricator/externals/figlet/zipio.c:481:7: [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(ptr, tmpbuf, len); data/phabricator-0~git20200925/phabricator/externals/figlet/zipio.c:588: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). zs->OpenFile = fopen(path, mode); data/phabricator-0~git20200925/arcanist/support/xhpast/parser.yacc.cpp:3349: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). # define yystrlen strlen data/phabricator-0~git20200925/arcanist/support/xhpast/scanner.lex.cpp:24592:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ data/phabricator-0~git20200925/arcanist/support/xhpast/scanner.lex.cpp:26407:33: [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 xhpast_scan_bytes(yystr,strlen(yystr) ,yyscanner); data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:91:7: [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(path)<strlen(suffix)) return 1; data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:91: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). if (strlen(path)<strlen(suffix)) return 1; data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:92: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). s = path + strlen(path) - strlen(suffix); data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:92:29: [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). s = path + strlen(path) - strlen(suffix); data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:131:7: [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(fileline)-1; data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:146: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). newlen=strlen(fileline); data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:247:10: [1] (buffer) fscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. numsread=fscanf(fontfile,"%4s",magicnum); data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:258:5: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). cha=getc(fontfile); data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:268:5: [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(fileline)>0 ? fileline[strlen(fileline)-1]!='\n' : 0) { data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:268:35: [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(fileline)>0 ? fileline[strlen(fileline)-1]!='\n' : 0) { data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:269:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(k=getc(fontfile),k!='\n'&&k!=EOF) ; /* Advance to end of line */ data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:360:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(k=getc(fontfile),k!='\n'&&k!=EOF) ; /* Advance to end of line */ data/phabricator-0~git20200925/phabricator/externals/figlet/chkfont.c:374:7: [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(fileline)-1; data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:82: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 MYSTRLEN(x) ((int)strlen(x)) /* Eliminate ANSI problem */ data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:147:19: [1] (buffer) wcslen: 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 STRLEN(x) wcslen(x) data/phabricator-0~git20200925/phabricator/externals/figlet/figlet.c:1707:10: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return( getchar() ); /* no: return stdin character */ data/phabricator-0~git20200925/phabricator/externals/figlet/getopt.c:42: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). (void) write(2, strlwr(argv[0]), (unsigned)strlen(argv[0]));\ data/phabricator-0~git20200925/phabricator/externals/figlet/getopt.c:43:34: [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). (void) write(2, s, (unsigned)strlen(s));\ ANALYSIS SUMMARY: Hits = 62 Lines analyzed = 41239 in approximately 3.02 seconds (13639 lines/second) Physical Source Lines of Code (SLOC) = 34934 Hits@level = [0] 137 [1] 21 [2] 26 [3] 3 [4] 12 [5] 0 Hits@level+ = [0+] 199 [1+] 62 [2+] 41 [3+] 15 [4+] 12 [5+] 0 Hits/KSLOC@level+ = [0+] 5.69646 [1+] 1.77478 [2+] 1.17364 [3+] 0.429381 [4+] 0.343505 [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.