Re: 08Jul00 version of Tidy doesn't have a previous bug fix?

On Thu, 13 Jul 2000, Terry Teague wrote:

> Dear Dave,
> 
> Updating my source code with the latest Tidy source for the 08Jul00
> version, I discovered one change that might not have made it into the
> source.
> 
> Specifically :
> 
> clean.c, line 303 :
> 
> Andy Quick offered a bug fix on 20 May 00 as follows :
> 
>         wstrcpy(s, classattr->value); /* wstrcpy(s, classname); */
> 
> Your version still has the original code. You took other bug
> fixes that other people made, but not this one. Was Andy wrong,
> or was this just an oversight on your part?

I just checked my master copy and found:

/*
 if there already is a class attribute
 then append class name after a space
*/
if (classattr)
{
  int len = wstrlen(classattr->value) + wstrlen(classname) + 2;
  char *s = (char *)malloc(len *sizeof(char));
  wstrcpy(s, classname);
  wstrcat(s, " ");
  wstrcat(s, classname);
  MemFree(classattr->value);
  classattr->value = s;
}
else /* create new class attribute */
  AddAttribute(node, "class", classname);

There is clearly a bug. The first wstrcpy needs to duplicate the
original value, i.e. to be: wstrcpy(s, classattr->value) so Andy is
right! I will include the fix in the next release.

Regards,

-- Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
tel/fax: +44 122 578 3011 (or 2521) +44 778 532 0444 (mobile)
World Wide Web Consortium (on assignment from HP Labs)

Received on Monday, 17 July 2000 16:08:34 UTC