Closed fat-tire closed 7 years ago
After applying the above changes I was also getting:
dirtyc0w.c: In function ‘main’:
dirtyc0w.c:99:3: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
printf("mmap %x\n\n",(uintptr_t) map);
^
So I changed line 99 to:
printf("mmap %lu\n\n",(uintptr_t) map);
Now I have no output at all. Maybe because it's patched?
@multiwebinc: If you don't get any output, I think it means that it compiled successfully. To make sure, check that the exit code was 0 by running this command:
echo Exit code: $?
Try %lx instead of %lu .
Actually %zx should make sure it's the right size no matter the pointer size. Anyway, I submitted this stuff to PR #17 if anyone wants it all at once. So someone test it...
@multiwebinc Try changing Line 99: printf("mmap %x\n\n",(uintptr_t) map); to Line 99 : unsigned int map_t = (uintptr_t) map; Line 100: printf("mmap %x\n\n", map_t);
Making this change works for me.
Erm why was this closed, @dirtycow?
The libc printf format character for a void pointer is %p
, no casts needed.
Didn't #17 fixed all of this?
Minor thing, but dirtyc0w.c says to build with:
This (at least for me, gcc 6.2.0) results in errors:
Using:
Works fine. Also some warnings can be gotten rid of by adding
I got rid of the rest by adding:
Then changing:
to
and
to
Dunno if this is correct- it very well may not be- but it builds quietly for me now on my raspberry pi. So there ya go.