Exemplo n.º 1
0
        /* goodG2B() - use GoodSource and BadSink */
        private static void GoodG2B()
        {
            StreamReader data;

            /* FIX: Open, but do not close the file in the source */
            data = File.OpenText(@"GoodSource_OpenText.txt");
            Hashtable dataHashtable = new Hashtable(5);

            dataHashtable.Add(0, data);
            dataHashtable.Add(1, data);
            dataHashtable.Add(2, data);
            CWE675_Duplicate_Operations_on_Resource__StreamReader_72b.GoodG2BSink(dataHashtable);
        }
Exemplo n.º 2
0
        /* goodB2G() - use BadSource and GoodSink */
        private static void GoodB2G()
        {
            StreamReader data;

            data = new StreamReader(@"BadSource_OpenText.txt");
            /* POTENTIAL FLAW: Close the file in the source */
            data.Close();
            Hashtable dataHashtable = new Hashtable(5);

            dataHashtable.Add(0, data);
            dataHashtable.Add(1, data);
            dataHashtable.Add(2, data);
            CWE675_Duplicate_Operations_on_Resource__StreamReader_72b.GoodB2GSink(dataHashtable);
        }