Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
C
cwe_checker
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • fact-gitdep
  • cwe_checker
  • Repository

Switch branch/tag
  • cwe_checker
  • test
  • artificial_samples
  • cwe_367.c
Find file
BlameHistoryPermalink
  • Thomas Barabosch's avatar
    Adds clang as second compiler for test cases (#27) · 5ad922d2
    * Added feature to compiler test cases with more than one compiler. Added clang as first examples. Fixed test cases to work with gcc
    
    * Added acceptance tests for clang x64, adjusted Travis scripts (now
    runs also unittests), install_cross_compilers installs also clang.
    
    * Skips test for cwe415, which is broken on clang + Ubuntu 16.04
    
    * Added feature to compiler test cases with more than one compiler. Added clang as first examples. Fixed test cases to work with gcc
    
    * Added acceptance tests for clang x64, adjusted Travis scripts (now
    runs also unittests), install_cross_compilers installs also clang.
    
    * Skips test for cwe415, which is broken on clang + Ubuntu 16.04
    
    * Added change to CHANGES.md
    
    * Fixed test issue: test for json output was pre-compiler suffix.
    Thomas Barabosch authored 5 years ago
    5ad922d2
cwe_367.c 386 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

int main(){

  if (access("file", W_OK) != 0) {
    exit(1);
  }

  char* buffer = malloc(6);
  if(buffer == NULL){
    exit(1);
  }
  memset(buffer, 1, 6);
  
  int fd = open("file", O_WRONLY);
  write(fd, buffer, sizeof(buffer));

  close(fd);
  free(buffer);
}
×

Replace cwe_367.c

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.