Esempio n. 1
0
        /* goodG2B() - use goodsource and badsink */
        private void GoodG2B()
        {
            StreamReader data = null;

            /* FIX: Open, but do not close the file in the source */
            data = File.OpenText(@"GoodSource_OpenText.txt");
            goodG2BPublicStatic = true;
            CWE675_Duplicate_Operations_on_Resource__StreamReader_22b.GoodG2BSink(data);
        }
Esempio n. 2
0
        /* goodB2G2() - use badsource and goodsink by reversing the blocks in the if in the sink function */
        private void GoodB2G2()
        {
            StreamReader data = null;

            data = new StreamReader(@"BadSource_OpenText.txt");
            /* POTENTIAL FLAW: Close the file in the source */
            data.Close();
            goodB2G2PublicStatic = true;
            CWE675_Duplicate_Operations_on_Resource__StreamReader_22b.GoodB2G2Sink(data);
        }
Esempio n. 3
0
        public override void Bad()
        {
            StreamReader data = null;

            data = new StreamReader(@"BadSource_OpenText.txt");
            /* POTENTIAL FLAW: Close the file in the source */
            data.Close();
            badPublicStatic = true;
            CWE675_Duplicate_Operations_on_Resource__StreamReader_22b.BadSink(data);
        }