/* goodG2B() - use goodsource and badsink */ private static void GoodG2B() { int data = CWE789_Uncontrolled_Mem_Alloc__Connect_tcp_HashSet_61b.GoodG2BSource(); /* POTENTIAL FLAW: Create a HashSet using data as the initial size. data may be very large, creating memory issues */ HashSet <int> intHashSet = new HashSet <int>(data); }
public override void Bad() { int data = CWE789_Uncontrolled_Mem_Alloc__Connect_tcp_HashSet_61b.BadSource(); /* POTENTIAL FLAW: Create a HashSet using data as the initial size. data may be very large, creating memory issues */ HashSet <int> intHashSet = new HashSet <int>(data); }