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");
            LinkedList <StreamReader> dataLinkedList = new LinkedList <StreamReader>();

            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            CWE675_Duplicate_Operations_on_Resource__OpenText_73b.GoodG2BSink(dataLinkedList);
        }
Exemplo n.º 2
0
        /* goodB2G() - use BadSource and GoodSink */
        private static void GoodB2G()
        {
            StreamReader data;

            data = File.OpenText(@"BadSource_OpenText.txt");
            /* POTENTIAL FLAW: Close the file in the source */
            data.Close();
            LinkedList <StreamReader> dataLinkedList = new LinkedList <StreamReader>();

            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            CWE675_Duplicate_Operations_on_Resource__OpenText_73b.GoodB2GSink(dataLinkedList);
        }