Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/23/04 06:51
Read: times


 
#74726 - RE: What do you doubt?
Responding to: ???'s previous message
In this case, note that the "%s" is superfluous - you just need::
// print szInterface to auxBuf
sprintf( auxBuf, par->INPS->szInterface );


Andy had said as above.

But you see he only included a "destination" and a "format" string. For many normal cases this would simply copy the format string to the destination. But if the "format" string (acting as source string in Andy's "tricky example") happens to have an embedded % character with a format field specification in it then the sprintf() function will look for non-existant [argument] and thus pull some bogus data out of the stack causing the undefined behavior as pointed out by Mr Catto.

Michael Karas


List of 19 messages in thread
TopicAuthorDate
doub about strutc pointers            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      
      What do you doubt?            01/01/70 00:00      
         RE: What do you doubt?            01/01/70 00:00      
            RE: What do you doubt?            01/01/70 00:00      
            RE: What do you doubt?            01/01/70 00:00      
               RE: What do you doubt?            01/01/70 00:00      
                  RE: What do you doubt?            01/01/70 00:00      
                  RE: What do you doubt?            01/01/70 00:00      
                     RE: What do you doubt?            01/01/70 00:00      
            RE: undefined behaviour land            01/01/70 00:00      
         RE: What do you doubt?            01/01/70 00:00      
         Still unknown doubt            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      
      Nothing 8051-specific here            01/01/70 00:00      
         RE: Nothing 8051-specific here            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      

Back to Subject List