The SAMATE Project Department of Homeland Security
Downloads:  Selected

Back to the previous page...Back to the previous page

Test Case IDCandidate13
Bad / GoodBadBad test case
AuthorN/A
Associated test caseN/A
ContributorSecureSoftware
LanguageC
Type of test caseSource Code
Input stringN/A
Expected OutputN/A
InstructionsN/A
Submission date2005-10-21
DescriptioniconAny condition where the attacker has the ability to write an arbitrary value to an arbitrary location, often as the result of a buffer overflow. (from TCCLASP-5_2_2_10)
Filename
Flaw
  • (?) CWE-123: Write-what-where Condition at line 5

There is no comments :: Submit a comment :: RSS

>./Write-what-where_condition.c
  1. #define BUFSIZE 256
  2. int main(int argc, char **argv) {
  3. char *buf1 = (char *) malloc(BUFSIZE);
  4. char *buf2 = (char *) malloc(BUFSIZE);
  5. strcpy(buf1, argv[1]);
  6. free(buf2);
  7. }
  8.  
  9.