info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: John Cavanaugh's branch locking patch updated for CVS 1.12.5


From: Claus Henriksen
Subject: Re: John Cavanaugh's branch locking patch updated for CVS 1.12.5
Date: Tue, 6 Jan 2004 09:42:53 +0100
User-agent: KMail/1.5.3

Tirsdag den 6. januar 2004 02:35 skrev du:
> -----BEGIN PGP SIGNED MESSAGE-----
>
> > --- snip
> > argBuf = xmalloc ( strlen(p->key) +
> >                 strlen(type_stat) +
> >                 strlen(tag_stat) +
> >                 strlen(li->rev_old) + 2);
>
> I'd suggest at least + 4 (the characters ':' + ':' + ':' + '\0' need to
> be accounted) rather than + 2. I would probably write it as
>

Yep/Thanx!! 
I also discovered + corrected the problem, and my page has been updated.  

>  size_t buflen, bufresult;
>  ...
>
>  buflen  = strlen(p->key)      + 1 /* ':' */ +
>            strlen(type_stat)   + 1 /* ':' */ +
>            strlen(tag_stat)    + 1 /* ':' */ +
>            strlen(li->rev_old) + 1 /* '\0' */
>
>  argBuf = xmalloc ( buflen );
>  bufresult = snprintf (argBuf, buflen, "%s:%s:%s:%s",
>                      p->key, type_stat, tag_stat, li->rev_old);
>  if (bufresult > buflen)

If this 'if' is true, wouldn't you say that we have a problem with wrong/bad 
terminated strings anyway, and that this would lead to a 
xmalloc/realloc-problem and -errormessage some time after all?

I mean, how much is 'to much' e.g. (buflen-bufresult)>PATH_MAX is probably a 
bad sign? (PATH_MAX just chosen since its a resonable big number).

BR,
  Claus

(I wonder how people can sell proprietary cm-solutions, when you know that 
corrections to the their code will probably never will be discussed 
openly/thoroughly enough like CVS corrections are discussed here in this 
info-list.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]