I'm reading a book about bufferoverflows and shellcode, and in the book there is this code below.
I understand most of it except the purpose of
buffer = command +strlen(command);
When one of the operands of
+ is a pointer then C does pointer arithmetic.
The result or
pointer + number is a pointer value that points to the value with index
number. It is equivalent to
So, in this case:
buffer = command + strlen(command);
is equivalent to
buffer = &command[strlen(command)];
buffer will point to the string terminator in
command, which is just the right place if you want to concatenate something to the