I love this book. So much.
Well at least so far...I'm having a problem running some of the example code. I've tried:
--Downloading the "booksrc" (the example files used in the book) from No Starch Press thinking maybe my disk drive corrupted it (it almost never works)
--Googling
-----"Warning: format not a string literal and no format arguments"
-----"hacking the art of exploitation troubleshoot"
-----"warning: format not a string literal"
-----"pointer.c" "format not a string literal" "hacking the art of exploitation"
but my googleFu is weak. Very weak.
So here I am. I kind of wish there was a specific forum for the No Starch Press books. Either way.
Here's what the pointer.c (from page 44) looks like in vim:
- Code: Select all
#include <stdio.h>
#include <string.h>
int main(){
char str_a[20]; // a 20 element character array
char *pointer; // a pointer, meant for a character array
char *pointer2; // and yet another one
strcpy(str_a, "Hello World\n");
pointer = str_a; // set the first pointer to the start of the array
printf(pointer);
pointer2 = pointer + 2; // set the second one 2 bytes further in
printf(pointer2); // print it
strcpy(pointer2, "y you guys!\n"); // copy into that spot
printf(pointer); // print again
}
Here's the error I get when I try to run pointer.c (from page 44 in the second edition):
- Code: Select all
~/booksrc# ./pointer.c
./pointer.c: line 4: syntax error near unexpected token `('
./pointer.c: line 4: `int main(){'
or if I gcc it:
- Code: Select all
~/booksrc# gcc pointer.c
pointer.c: In function ‘main’:
pointer.c:11: warning: format not a string literal and no format arguments
pointer.c:14: warning: format not a string literal and no format arguments
pointer.c:16: warning: format not a string literal and no format arguments
Specs about my box:
--Late 2009 Unibody MacBook Pro (We get a mega discount through my school. Please don't start a Mac v Windows debate

)
--Snow Leopard V. 10.6.8
--Enough ram and memory to support everything.
My Virtual Machine:
--VirtualBox 4.0.12 r72916
runnning
--Backtrack 5 32bit
..
I have all of the dependencies (I'm pretty sure).
I'm not super familiar with C (of any kind) programming, but from what I can tell, there's nothing wrong with the code.
My only other thought is that maybe there's been an update or something to gcc...but I doubt it.
If you have any ideas about why this is happening, where else I can look, or where else I can post to, or anything else PLEASE reply.
Thanks yawl.
1st post of many (hopefully) btw
