S
Steffen Fiksdal
I have programmed a library which offers an API which takes both
'const char*' and 'char**' pointers as input parameters.
An example:
extern int apicall( int sessioncontext,
const char* input,
char** output );
This method will use the input data, do some processing, allocate memory
from heap and put the result of malloc() to *output. Then the memory is
filled with whatever....
If I am related to dr.ing. evil I might want to:
int res;
res=apicall(1,(const char*)12345,(char**)423B);
I would like to validate the inputB pointer
before reading from it (most probably creating a read segfault).
I have noticed that most people write: "You can't!".
Is it *absolutely* true. Is there no way I can look into segment registers
etc, to validate the range the pointer is in C?
The same question goes for a good write segfault candidate,
*output = malloc(10);, if output itself is garbage...
Best regards,
Steffen
'const char*' and 'char**' pointers as input parameters.
An example:
extern int apicall( int sessioncontext,
const char* input,
char** output );
This method will use the input data, do some processing, allocate memory
from heap and put the result of malloc() to *output. Then the memory is
filled with whatever....
If I am related to dr.ing. evil I might want to:
int res;
res=apicall(1,(const char*)12345,(char**)423B);
I would like to validate the inputB pointer
before reading from it (most probably creating a read segfault).
I have noticed that most people write: "You can't!".
Is it *absolutely* true. Is there no way I can look into segment registers
etc, to validate the range the pointer is in C?
The same question goes for a good write segfault candidate,
*output = malloc(10);, if output itself is garbage...
Best regards,
Steffen