IPC msgrcv - writing overflows memory extra 4 bytes
I have the following structure:
#define ZZ_SIMMSG_DATA_SIZE 1000
int length; // length of used data area
unsigned char data[ZZ_SIMMSG_DATA_SIZE];
In another file I have the following code:
struct T_simmsg rx_msg
result = msgrcv(msqid, &rx_msg, sizeof(rx_msg), ZZ_TASK_STARTED, IPC_NOWAIT);
I am using a memory tool check that checks for memory leaks, write and read overflows etc...
The above code causes a "writing overflows memory" error. Where the rx_msg has a size of 1020 my program seems to want to write 1024? Whatever the value of 'ZZ_SIMMSG_DATA_SIZE + 20' there is always an extra 4 bytes.
When I put a printf statement for the size of rx_msg it returns 'ZZ_SIMMSG_DATA_SIZE + 20', as expected
Can anyone tell me why?? and how do I fix it
Last edited by tara; 11-08-2005 at 11:19 PM.