read open

#include<stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include<stdio.h>
void exploit(){
        system("/bin/sh");
}
void func(){
        char str[0x20];
        int fd=open('./buff.txt',
        read(1,str,0x50);
}
int main(){
        func();
        return 0;
}

 

O_RDONLY read only 只读
O_WRONLY  write only 只写
O_RDWR read write 可读可写
O_CREAT 若文件存在,此标志无用;若不存在,建新文件
O_TRUNC 若文件存在,则长度被截为0,属性不变,长度被截为0的意思是清空原来文件内容

 

 

 

 https://www.dotcpp.com/course/454

 

 

 https://www.dotcpp.com/course/460

https://blog.csdn.net/weixin_39296438/article/details/79422068

 

 

 

 

 

http://c.biancheng.net/view/2054.html

fwrite fwrite(buffer, 1, strlen("This is a test")+1, fp)

 

posted @ 2022-01-26 00:06  磐正  阅读(48)  评论(0)    收藏  举报