home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1147 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: comma.rhein.de!serpens!not-for-mail
  2. From: mlelstv@serpens.rhein.de (Michael van Elst)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: MsgPorts
  5. Date: 16 Jan 1996 01:47:33 +0100
  6. Organization: dis-
  7. Message-ID: <4desj5$bi8@serpens.rhein.de>
  8. References: <2005.6588T1264T489@Th0r.foo.bar>
  9. NNTP-Posting-Host: serpens.rhein.de
  10.  
  11. christon (Christopher Naas) writes:
  12.  
  13. >      if (mymsgport = AllocVec (sizeof (struct MsgPort), MEMF_ANY|MEMF_CLEAR))
  14. >      {
  15. >         if (mymsgport = CreateMsgPort ())
  16.  
  17. This overwrites the mymsgport pointer.
  18.  
  19. >                  PutMsg (mymsgport, (struct Message *)kmsg);
  20.  
  21. This sends the message without making sure that it isn't reused. Send it
  22. twice and you are dead.
  23.  
  24. >                  ReplyMsg ((struct Message *)kmsg);
  25.  
  26. This kills the system as the message has no valid replyport.
  27.  
  28. >         FreeVec (mymsgport);
  29.  
  30. Here you reuse the overwritten pointer and free memory twice, even with invalid
  31. size information.
  32.  
  33.  
  34. -- 
  35.                                 Michael van Elst
  36.  
  37. Internet: mlelstv@serpens.rhein.de
  38.                                 "A potential Snark may lurk in every tree."
  39.