Skip to content

Commit 374f700

Browse files
committed
Add rmdir rule
1 parent dc64a51 commit 374f700

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

rules/unistd/ir_unsafe.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,31 @@
7272
"type": "i64"
7373
}
7474
},
75+
"f11": {
76+
"body": [
77+
{
78+
"text": "libc::rmdir("
79+
},
80+
{
81+
"placeholder": {
82+
"arg": 0,
83+
"access": "read"
84+
}
85+
},
86+
{
87+
"text": " as *const i8)"
88+
}
89+
],
90+
"params": {
91+
"a0": {
92+
"type": "*const u8",
93+
"is_unsafe_pointer": true
94+
}
95+
},
96+
"return_type": {
97+
"type": "i32"
98+
}
99+
},
75100
"f2": {
76101
"body": [
77102
{

rules/unistd/src.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ int f9(char *name, size_t len) { return gethostname(name, len); }
2424
ssize_t f10(int fd, const void *buf, size_t count) {
2525
return write(fd, buf, count);
2626
}
27+
28+
int f11(const char *pathname) { return rmdir(pathname); }

rules/unistd/tgt_unsafe.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@ unsafe fn f9(a0: *mut u8, a1: u64) -> i32 {
4040
unsafe fn f10(a0: i32, a1: *const ::libc::c_void, a2: u64) -> i64 {
4141
libc::write(a0, a1, a2 as usize) as i64
4242
}
43+
44+
unsafe fn f11(a0: *const u8) -> i32 {
45+
libc::rmdir(a0 as *const i8)
46+
}

0 commit comments

Comments
 (0)