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: Mark D. Baushke
Subject: Re: John Cavanaugh's branch locking patch updated for CVS 1.12.5
Date: Tue, 06 Jan 2004 01:03:07 -0800

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Claus Henriksen <address@hidden> writes:

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

Good.

> >  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?

Provided the if condition is true, there would likely be some kind of
problem somewhere.

I wish that vsprintf() were more portable as that is really the right
way to deal with the problem.

> 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).

It would not be a good sign... if you don't want to have the extra logic
to try again, maybe just putting an

   assert (bufresult < buflen);

should be sufficient.

In any case, I hope your code finds the audience that wants it.

> 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.)

:-)

        -- Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/+nnL3x41pRYZE/gRAqCdAKDB5+i/lpARNcNpGdMi0N5FTBFHOACffbTZ
9Lv2eKcVBkDzOoNWj7zl12o=
=8mgv
-----END PGP SIGNATURE-----




reply via email to

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