W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2006

Re: HTCookie.c Patch

From: Vic Bancroft <bancroft@america.net>
Date: Sun, 18 Jun 2006 09:23:08 -0400
Message-ID: <449553BC.1020105@america.net>
To: Jesse Morgan <jesse@krypton.jesterpm.net>
CC: www-lib@w3.org

Jesse Morgan wrote:

>I was using libwww and discovered issues when the value of a cookie is either null or contains = signs. 
>
Ouch.

>The attached patch fixes the issue. The patch is against the 5.4.0 release.
>  
>
Most excellent, here is what it looks like as applied to the HEAD . . .

[bancroft@hilbert libwww]$ cvs diff ChangeLog Library/src/HTCookie.c
Index: ChangeLog
===================================================================
RCS file: /sources/public/libwww/ChangeLog,v
retrieving revision 1.55
diff -r1.55 ChangeLog
2a3,7
> 2006-06-18       Vic Bancroft <bancroft@america.net>
>
>       * Library/src/HTCookie.c: add private function HTCookie_splitPair to
>         split a KEY=VALUE pair, from Jesse Morgan
>
Index: Library/src/HTCookie.c
===================================================================
RCS file: /sources/public/libwww/Library/src/HTCookie.c,v
retrieving revision 2.5
diff -r2.5 HTCookie.c
244a245,263
> ** Added By Jesse Morgan <jesse@jesterpm.net> on 2006-05-22
> ** Splits a KEY=VALUE pair into a KEY and VALUE
> */
> PRIVATE int HTCookie_splitPair (char * pair, char ** key, char ** value)
> {
>       char * index = strchr(pair, '=');
>
>       if (index == NULL) {
>                       return HT_ERROR;
>       }
>
>       *key    = pair;
>       *index  = '\0';
>       *value  = ++index;
>
>       return HT_OK;
> }
>
> /*
253,254c272,278
<     char * cookie_name = HTNextField(&value);
<     char * cookie_value = HTNextField(&value);
---
>     char * cookie_name = NULL;
>     char * cookie_value = NULL;
>
>     if (HTCookie_splitPair(HTNextParam(&value), &cookie_name, &cookie_value) != HT_OK) {
>        return HT_ERROR; /* Malformed Cookie */
>     }
>
267,268c291,297
<           char * tok = HTNextField(&param_pair);
<           char * val = param_pair;
---
>           char * tok = NULL;
>           char * val = NULL;
>
>           if (HTCookie_splitPair(param_pair, &tok, &val) != HT_OK) {
>             return HT_ERROR; /* Malformed Cookie */
>           }
>

This results in new revision: 1.56 of ChangeLog and new revision: 2.6 of 
HTCookie.c . . .

more,
l8r,
v

-- 
"The future is here. It's just not evenly distributed yet."
 -- William Gibson, quoted by Whitfield Diffie
Received on Sunday, 18 June 2006 13:23:18 GMT

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