joern/src/tools/data_flow/Find_data_paths.java
// NOTE: get_calls_to does NOT include func-ptrs
get_calls_to does NOT include func-ptrs
get_calls_to does NOT include func - ptrs
public static List<Long> find_all_user_controlled_sources(Joern_db joern_db)
   {
   List<Long> ucs = new ArrayList();
   HashMap<String, List<Long>> sources = User_controlled_sources.get_user_controlled();
     for(String func_name : sources.keySet())
      {
        if(sources.get(func_name).contains(new Long(-1)))
         {
         List<Node> source_calls = Joern_db.get_calls_to(func_name);
           for(Node s : source_calls)
             {
              ucs.add(s.getId());
             }
         }
        else
         {
         List<Node> source_calls = Joern_db.get_calls_to(func_name);
           for(Node s : source_calls)
            {
            List<Node> arguments = Pipeline.v(s.getId()).children().has("type", "ArgumentList").children().to_list();
            int nof_children = arguments.size();
              for(Long child_index : sources.get(func_name))
               {
                 if(nof_children > child_index)
                  {
                   ucs.add(arguments.get(child_index.intValue()).getId());
                  }
               }
            }
         }
      }
    return ucs;
   }
public static List < Long > find_all_user_controlled_sources ( Joern_db joern_db ) { List < Long > ucs = new ArrayList ( ) ; HashMap < String , List < Long > > sources = User_controlled_sources . get_user_controlled ( ) ; for ( String func_name : sources . keySet ( ) ) { if ( sources . get ( func_name ) . contains ( new Long ( - 1 ) ) ) { List < Node > source_calls = Joern_db . get_calls_to ( func_name ) ; for ( Node s : source_calls ) { ucs . add ( s . getId ( ) ) ; } } else { List < Node > source_calls = Joern_db . get_calls_to ( func_name ) ; for ( Node s : source_calls ) { List < Node > arguments = Pipeline . v ( s . getId ( ) ) . children ( ) . has ( "type" , "ArgumentList" ) . children ( ) . to_list ( ) ; int nof_children = arguments . size ( ) ; for ( Long child_index : sources . get ( func_name ) ) { if ( nof_children > child_index ) { ucs . add ( arguments . get ( child_index . intValue ( ) ) . getId ( ) ) ; } } } } } return ucs ; }
NOTE: get_calls_to does NOT include func-ptrs
NOTE : get_calls_to does NOT include func - ptrs
// return parameter is user_controlled => each call is a source // CallExpression -> ArgumentList -> [Arguments]