GHAAAAAAARGH!!! STATUS_ACCESS VIOLATION
-
Hi all, I'm going out of my mind on this problem and would really appreciate some help. I am currently writing an NT service that has two threads running. One thread is at a point where it has to create a network message and send it over a socket. However, when I try to malloc some memory for a buffer I get an NT_STATUS_ACCESS_VIOLATION exception. The code looks simple enough to me:
totlen = sizeof(BH_MESSAGE) + msglen; //This evaluates to 306 char* totbuf = (char *) malloc(totlen);
Any ideas coz I'm really going :wtf: crazy Regards, Mark -
Hi all, I'm going out of my mind on this problem and would really appreciate some help. I am currently writing an NT service that has two threads running. One thread is at a point where it has to create a network message and send it over a socket. However, when I try to malloc some memory for a buffer I get an NT_STATUS_ACCESS_VIOLATION exception. The code looks simple enough to me:
totlen = sizeof(BH_MESSAGE) + msglen; //This evaluates to 306 char* totbuf = (char *) malloc(totlen);
Any ideas coz I'm really going :wtf: crazy Regards, MarkProbably the heap got corrupted before your malloc call. A buffer overrun is the most common cause, and it's usually a hard thing to find; there are several tools on the market to help debug heap corruption. A simple (and cheap) thing to try is calling _CrtSetDbgFlag with at least the _CRTDBG_CHECK_ALWAYS_DF flag set. Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski