[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Question about memory under MagiC



Hi,

Sorry for this off-topic question but I'm bewildered by a problem that doesn't 
make sense to me.

I'm developing an accessory that I would like to be compatible with MagiC. In 
this program there is a piece of code that writes a string into a Mxalloc'ed 
buffer (a simple "strcpy(buffer, path);"). I'm 100% confident both the source 
and destination (with space for the terminating null) are the exact same size 
so this is not the problem and indeed this works fine under MiNT with MP on.

However, under MagiC (tested by someone else) it crashes ("Memory block 
destroyed by user program" message from MagiC).

So, out of curiosity, I tried with snprintf() and this works under MagiC! Once 
again, I know for a fact both source and dest are equal sizes. Why would MagiC 
accept snprintf() but crash with strcpy() when the destination buffer is large 
enough for the string + terminating '\0'?

Are there known memory allocation differences between the two systems?

Thanks in advance for any info anyone might have.

Cheers,
JFL
-- 
Jean-François Lemaire