Skip to content

Commit 24ca03a

Browse files
author
=josephproject1
committed
Provenance of the pointer tracks
1 parent 86cbb86 commit 24ca03a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

CHERIProvenanceOfPointer.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include<cheri.h>
2+
#include<stdio.h>
3+
4+
int main(){
5+
6+
int myArray[10];
7+
8+
int *ptr = &myArray[0]; // storing the pointer as a capability
9+
10+
//perform a capability safe operation - accessing a valid element
11+
12+
int myValue = *ptr;
13+
14+
// access within bounds
15+
16+
int *new_ptr = ptr + 5;
17+
18+
printf("valid value : %d\n", myValue);
19+
20+
return 0;
21+
22+
}

0 commit comments

Comments
 (0)