Add ability to list CWEs in source code
This commit is contained in:
parent
c1211121bf
commit
289f341f90
|
@ -0,0 +1,29 @@
|
||||||
|
%{
|
||||||
|
|
||||||
|
/* cwe by David A. Wheeler (http://www.dwheeler.com).
|
||||||
|
This prints anything of the form CWE-#
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void out(char *text) {
|
||||||
|
fputs(text,stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void outchar(char c) {
|
||||||
|
fputc(c, stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
%%
|
||||||
|
CWE-[1-9][0-9]* { out(yytext); outchar('\n'); }
|
||||||
|
. { }
|
||||||
|
\n { }
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
7
makefile
7
makefile
|
@ -147,6 +147,13 @@ my_install: flawfinder.pdf flawfinder.ps
|
||||||
test.c test2.c test-results.txt test-results.html \
|
test.c test2.c test-results.txt test-results.html \
|
||||||
/home/dwheeler/dwheeler.com/flawfinder
|
/home/dwheeler/dwheeler.com/flawfinder
|
||||||
|
|
||||||
|
# This is intended to be a local capability to list CWEs
|
||||||
|
show-cwes:
|
||||||
|
flex -o cwe.c cwe.l
|
||||||
|
gcc -o cwe cwe.c -lfl
|
||||||
|
./cwe < flawfinder | sort -u
|
||||||
|
|
||||||
|
|
||||||
.PHONY: install clean test check profile test-is-correct rpm uninstall distribute
|
.PHONY: install clean test check profile test-is-correct rpm uninstall distribute
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue