X-Git-Url: https://git.ralfj.de/web.git/blobdiff_plain/46b102a4da62b720af9bfa176f5b45a38e66eddd..74b2ab6a7fc0cc672673687dcd894adcfe0426d2:/personal/_posts/2022-04-11-provenance-exposed.md?ds=sidebyside diff --git a/personal/_posts/2022-04-11-provenance-exposed.md b/personal/_posts/2022-04-11-provenance-exposed.md index 317cc30..5265df6 100644 --- a/personal/_posts/2022-04-11-provenance-exposed.md +++ b/personal/_posts/2022-04-11-provenance-exposed.md @@ -78,7 +78,7 @@ static int uwu(int *restrict x, int *restrict y) { int *y2 = y-1; uintptr_t y2addr = (uintptr_t)y2; - int *ptr = (int*)y2addr; + int *ptr = (int*)y2addr; // <-- using y2addr *ptr = 1; return *x; @@ -104,12 +104,12 @@ static int uwu(int *restrict x, int *restrict y) { int *ptr = (int*)y2addr; *ptr = 1; - return 0; + return 0; // <-- hard-coded return value } int main() { - int i = 0; - int res = uwu(&i, &i); + int i[2] = {0, 0}; + int res = uwu(&i[0], &i[1]); // Now this prints 0! printf("%d\n", res); }