/* goodB2G() - use badsource and goodsink */ private static void GoodB2G() { data = new StreamReader(@"BadSource_OpenText.txt"); /* POTENTIAL FLAW: Close the file in the source */ data.Close(); CWE675_Duplicate_Operations_on_Resource__StreamReader_68b.GoodB2GSink(); }
public override void Bad() { data = new StreamReader(@"BadSource_OpenText.txt"); /* POTENTIAL FLAW: Close the file in the source */ data.Close(); CWE675_Duplicate_Operations_on_Resource__StreamReader_68b.BadSink(); }
/* goodG2B() - use goodsource and badsink */ private static void GoodG2B() { /* FIX: Open, but do not close the file in the source */ data = File.OpenText(@"GoodSource_OpenText.txt"); CWE675_Duplicate_Operations_on_Resource__StreamReader_68b.GoodG2BSink(); }