Advice needed (also warning to others!)
Posted: Fri Aug 04, 2006 4:08 am
Hi people,
I've made my first server system interface for writing drivers in my os.
One of the system calls I have is
waitServerRequest(server_id,request_number,void *buffer,unsigned long *length)
server_id is the handle for the server that you made the request from
request_number is the handle for the request. you can have multipe requests at anytime
buffer is where the data is going to be copied to(your buffer)
length is where the system tell you how much data was copied
It works fine. My question is this -
How can I check that some buffer is not pointing to an invalid address?
Am asking cause I did this in my test code
as you can see I used &track_buffer (which makes it a pointer to a pointer) which was sending the address of the track_buffer pointer instead of the address in track_buffer.
This was crashing my OS!!
How can I test for this and prevent this from happening?
Thanks
I've made my first server system interface for writing drivers in my os.
One of the system calls I have is
waitServerRequest(server_id,request_number,void *buffer,unsigned long *length)
server_id is the handle for the server that you made the request from
request_number is the handle for the request. you can have multipe requests at anytime
buffer is where the data is going to be copied to(your buffer)
length is where the system tell you how much data was copied
It works fine. My question is this -
How can I check that some buffer is not pointing to an invalid address?
Am asking cause I did this in my test code
Code: Select all
unsigned char *track_buffer;
unsigned long length;
.....
....
waitServerRequest(floppy_id,request_number,&track_buffer,&length);
This was crashing my OS!!
How can I test for this and prevent this from happening?
Thanks