text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE194_Unexpected_Sign_Extension__rand_memmove_61b.c
  Label Definition File: CWE194_Unexpected_Sign_Extension.label.xml
  Template File: sources-sink-61b.tmpl.c
  */
  /*
   * @description
   * CWE: 194 Unexpected Sign Extension
   * BadSource: rand Set data to result of rand(), which could be negative
   * GoodSource: Positive integer
   * Sinks: memmove
   *    BadSink : Copy strings using memmove() with the length of data
   * Flow Variant: 61 Data flow: data returned from one function to another in different source files
   *
   * */
  
  #include "std_testcase.h"
  
  #ifndef OMITBAD
  
  short CWE194_Unexpected_Sign_Extension__rand_memmove_61b_bad_source(short data)
  {
      /* POTENTIAL FLAW: Use a random value that could be less than 0 */
      data = (short)RAND32();
      return data;
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B() uses the GoodSource with the BadSink */
  short CWE194_Unexpected_Sign_Extension__rand_memmove_61b_goodG2B_source(short data)
  {
      /* FIX: Use a positive integer less than &InitialDataSize&*/
      data = 100-1;
      return data;
  }
  
  #endif /* OMITGOOD */
  