Commit 4034acbb by Thomas Barabosch Committed by Enkelmann

Fixed CWE367: use symbols defined in config.json (#28)

parent 08951c01
...@@ -2,6 +2,7 @@ dev ...@@ -2,6 +2,7 @@ dev
==== ====
- Added more documentation to checks (PR #26) - Added more documentation to checks (PR #26)
- Fixed check CWE367: use symbols defined in config.json (PR #28)
0.2 (2019-06-25) 0.2 (2019-06-25)
===== =====
......
...@@ -34,7 +34,9 @@ let is_reachable sub source sink = ...@@ -34,7 +34,9 @@ let is_reachable sub source sink =
let sink_blk = get_blk_tid_of_tid sub sink_tid in let sink_blk = get_blk_tid_of_tid sub sink_tid in
Graphlib.Std.Graphlib.is_reachable (module Graphs.Tid) cfg source_blk sink_blk Graphlib.Std.Graphlib.is_reachable (module Graphs.Tid) cfg source_blk sink_blk
let handle_sub sub program tid_map _symbols source sink = let handle_sub sub program tid_map _symbols source_sink_pair =
match source_sink_pair with
| [source;sink;] -> begin
if (Symbol_utils.sub_calls_symbol program sub source) && (Symbol_utils.sub_calls_symbol program sub sink) then if (Symbol_utils.sub_calls_symbol program sub source) && (Symbol_utils.sub_calls_symbol program sub sink) then
begin begin
let calls = Symbol_utils.get_direct_callsites_of_sub sub in let calls = Symbol_utils.get_direct_callsites_of_sub sub in
...@@ -56,7 +58,10 @@ let handle_sub sub program tid_map _symbols source sink = ...@@ -56,7 +58,10 @@ let handle_sub sub program tid_map _symbols source sink =
end end
else else
() ()
end
| _ -> ()
let check_cwe program _proj tid_map _symbol_pairs _ = let check_cwe program _proj tid_map symbol_pairs _ =
let symbols = Symbol_utils.build_symbols ["access"; "open";] in List.iter symbol_pairs ~f:(fun current_pair ->
Seq.iter (Term.enum sub_t program) ~f:(fun s -> handle_sub s program tid_map symbols "access" "open") let symbols = Symbol_utils.build_symbols current_pair in
Seq.iter (Term.enum sub_t program) ~f:(fun s -> handle_sub s program tid_map symbols current_pair))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment