W3C home > Mailing lists > Public > www-lib@w3.org > October to December 2000

bug in HTCookie.c in w3c-libwww-pre-5.3.0

From: Francois Nicot <fnicot@silicom.fr>
Date: Mon, 04 Dec 2000 18:24:34 +0100
Message-ID: <3A2BD352.B0F305A8@silicom.fr>
To: "www-lib@w3.org" <www-lib@w3.org>
Hi all,

see below my comments on w3c-libwww-pre-5.3.0  HTCookie.c

1 Major bug
1 Minor bug


Major
***************************
memory leak
PRIVATE int HTCookie_afterFilter (HTRequest * request, HTResponse *
response,
                                  void * param, int status)       

   char * host = HTParse(addr, "", PARSE_HOST); <---- host is allocated

   if (CookieMode & HT_COOKIE_SAME_DOMAIN)
      res = tailcasecomp(cookie_host, host);
   else
      res = strcasecomp(cookie_host, host);

 host is never deallocated after its use!!

Minor
***********************************************
here, use of a Assoc Module macro (HTAssocList_nextObject) instead of
HTList_nextObject to handle a HTList* object.
It is a minor bug ,but it could be a major one if definitions of
HTAssocList or HTList would change.

PRIVATE int HTCookie_afterFilter (HTRequest * request, HTResponse *
response,
                                  void * param, int status)
{
    if ((CookieMode & HT_COOKIE_ACCEPT) && SetCookie) {
        HTCookieHolder * holder = HTCookieHolder_find(request);
        if (holder) {
            HTList * cookies = holder->cookies;
            HTCookie *
pres;                                                                         
            while ((pres = (HTCookie *)
HTAssocList_nextObject(cookies))) { <---- the problem is here    

Bye.                                                                                                    
-- 
Francois NICOT     fnicot@silicom.fr
SILICOM Region Ouest  02 99 84 17 17
80, avenue des buttes de Coesmes
35700 RENNES
Received on Monday, 4 December 2000 12:19:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:38 GMT