text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE369_Divide_by_Zero__int_zero_divide_51b.c
  Label Definition File: CWE369_Divide_by_Zero__int.label.xml
  Template File: sources-sinks-51b.tmpl.c
  */
  /*
   * @description
   * CWE: 369 Divide by Zero
   * BadSource: zero Fixed value of zero
   * GoodSource: Non-zero
   * Sinks: divide
   *    GoodSink: Check for zero before dividing
   *    BadSink : Divide a constant by data
   * Flow Variant: 51 Data flow: data passed as an argument from one function to another in different source files
   *
   * */
  
  #include "std_testcase.h"
  
  #ifndef OMITBAD
  
  void CWE369_Divide_by_Zero__int_zero_divide_51b_badSink(int data)
  {
      /* POTENTIAL FLAW: Possibly divide by zero */
      printIntLine(100 / data);
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B uses the GoodSource with the BadSink */
  void CWE369_Divide_by_Zero__int_zero_divide_51b_goodG2BSink(int data)
  {
      /* POTENTIAL FLAW: Possibly divide by zero */
      printIntLine(100 / data);
  }
  
  /* goodB2G uses the BadSource with the GoodSink */
  void CWE369_Divide_by_Zero__int_zero_divide_51b_goodB2GSink(int data)
  {
      /* FIX: test for a zero denominator */
      if( data != 0 )
      {
          printIntLine(100 / data);
      }
      else
      {
          printLine("This would result in a divide by zero");
      }
  }
  
  #endif /* OMITGOOD */
  