text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE617_Reachable_Assertion__fgets_52c.c
  Label Definition File: CWE617_Reachable_Assertion.label.xml
  Template File: sources-sink-52c.tmpl.c
  */
  /*
   * @description
   * CWE: 617 Reachable Assertion
   * BadSource: fgets Read data from the console using fgets()
   * GoodSource: Number greater than ASSERT_VALUE
   * Sink:
   *    BadSink : Assert if n is less than or equal to ASSERT_VALUE
   * Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files
   *
   * */
  
  #include "std_testcase.h"
  
  #include <assert.h>
  
  #define ASSERT_VALUE 5
  
  #define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)
  
  /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
  
  #ifndef OMITBAD
  
  void CWE617_Reachable_Assertion__fgets_52c_badSink(int data)
  {
      /* POTENTIAL FLAW: this assertion could trigger if n <= ASSERT_VALUE */
      assert(data > ASSERT_VALUE);
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B uses the GoodSource with the BadSink */
  void CWE617_Reachable_Assertion__fgets_52c_goodG2BSink(int data)
  {
      /* POTENTIAL FLAW: this assertion could trigger if n <= ASSERT_VALUE */
      assert(data > ASSERT_VALUE);
  }
  
  #endif /* OMITGOOD */
  