well, something is wrong with that code i don't understand. It caused a buffer overflow. How can this be avoided?"The value of ESP was not properly saved across a function call. This is usually a result of calling a functiondeclared with one calling convention with a function pointer declared with a different calling convention. .onexit.cFFF.FFFFFFFF.FFF.75.66.2E ..@.c...str != NULL.flag == 0 || flag == 1...................EEE.....50.P.... (8PX.."
Actually I don't understand you what do you mean by ESP, and can you send me the code where the BoF has occured !?
ESP is the extended Segment Pointer, a register in the processor that point to the current memory segment in ram.
OIC, so you found that by using GDB or some simillar debugger right ?As far as I see, it seems that you have called the function using a pointer to something that is not char*So let me do some changes (I'll replace that char* with void*) and try usin it now.