Re: [Code] general ack!!!

From: invincibill (long@hercules.ntsource.com)
Date: 01/27/97


disregard this..its afu....i cant believe i wrote it
> 
> the reason for this is because *message is a pointer to a character.
> the pointer, for most compilers is 4bytes sometimes 8.  the character is
> 1 byte.  when you include message like that in the printf statement, you
> are sending in the pointer value and type.  the compiler doesnt care, it
> assumes you know what you want.  when you get to the runtime and you
> havent taken precautions, BAM you get sprintf trying to access a memory
> location which holds a character value when it actuality it holds part
> of the value for a pointer.  not knowing exactly how printf handles it,
> all you can assume is that you'll get undefined results(as the c gurus
> put it...) and you can expect improper memory access at best and a crash
> at worse.
> 
> this is probably babblized, i'm tired, but i hope i helped clear it up
> just a bit.

whats happening is that printf is looking for a NULL(zero) value.  it
will look until it finds it.  in searching, it runs amuck through other
memory...
-- 
** I truely believe that the internet will do more to bring about world
peace than any other devicein human history. **
http://www.ntsource.com/~long        Myths of Time Mud 
telnet://206.152.243.1:4000
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST