[JDEV] bug in AIM Transport

stonewell stonewell at 21cn.com
Thu Jun 15 19:49:09 CDT 2000


Hi,
    in libfaim aim_snac.c function 

int aim_cleansnacs(struct aim_session_t *sess,
     int maxage)
{
  struct aim_snac_t *cur;
  struct aim_snac_t *remed = NULL;
  time_t curtime;
 
  cur = sess->outstanding_snacs;
  
  curtime = time(&curtime);
 
  while (cur)
    {
      if ( (cur) && (((cur->issuetime) + maxage) < curtime))
 {
#if DEBUG > 1
   printf("aimsnac: WARNING purged obsolete snac %08lx\n", cur->id);
#endif

   remed = aim_remsnac(sess, cur->id);
   if (remed)
     {
       if (remed->data)
  free(remed->data);
       free(remed);
     }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    after exec this statment,it cause a crash
~~~~~~~~~~~~~~~~~~~~~~~~~~~
 }
      cur = cur->next;
    }
  
  return 0;
}

so maybe change function to this


int aim_cleansnacs(struct aim_session_t *sess,
     int maxage)
{
  struct aim_snac_t *cur;
  struct aim_snac_t *curnext;
  struct aim_snac_t *remed = NULL;
  time_t curtime;
 
  cur = sess->outstanding_snacs;
  
  curtime = time(&curtime);
 
  while (cur)
    {
        curnext = cur;
      if ( (cur) && (((cur->issuetime) + maxage) < curtime))
 {
#if DEBUG > 1
   printf("aimsnac: WARNING purged obsolete snac %08lx\n", cur->id);
#endif

   remed = aim_remsnac(sess, cur->id);
   if (remed)
     {
       if (remed->data)
  free(remed->data);
       free(remed);
     }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    after exec this statment,it cause a crash
~~~~~~~~~~~~~~~~~~~~~~~~~~~
 }
      cur = curnext;
    }
  
  return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20000616/cd7bf5d4/attachment-0002.htm>


More information about the JDev mailing list