[Top][All Lists]
[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: |
Mon, 5 Jan 2004 23:19:59 +0100 |
User-agent: |
KMail/1.5.3 |
Hi Mark,
and thanx for comments/hints.
Mandag den 5. januar 2004 21:34 skrev du:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Claus Henriksen <address@hidden> writes:
> > for those interested I have updated John Cavanaugh's CVS patch and
> > perlscripts that provides a branch-protection mechanishm, so that it
> > is compatible with CVS 1.12.5 .
> >
> > Here it is
> >
> > http://www.motimeter.dk/branchprotector
> >
> > It works ok as far as I have tested. Any comments are welcome.
>
> Hint. The use of context or a unified diff would probably be 'better' for
> http://www.motimeter.dk/branchprotector/commit-patch-1.12-5.diff in case
> folks are running other custom-patches in their cvs sources. Also, most
> folks would rather see a forward patch rather than a reverse patch.
>
> diff -c2p commit.1.12.5.c commit.c
> or
> diff -up commit.1.12.5.c commit.c
>
> might generate a more portable patch for your audience.
>
Ok - done.
> That said, be advised that the use of sprintf() could open you up to a
> buffer overrun if the argument is close to PATH_MAX in length. I suggest
> you may wish to use snprintf and pass in the size of argBuf. Or, failing
> that, do the length check yourself
>
> snprintf(argBuf, sizeof argBuf,
> "%s:%s:%s:%s", p->key, type_stat, tag_stat, li->rev_old);
>
Ok - done.
--- snip
argBuf = xmalloc ( strlen(p->key) +
strlen(type_stat) +
strlen(tag_stat) +
strlen(li->rev_old) + 2);
sprintf(argBuf,"%s:%s:%s:%s",p->key,type_stat,tag_stat,li->rev_old);
run_arg (argBuf);
free(argBuf);
--- snap
I compiled/installed and ran a little test ok.
> you should also compare the return value from snprintf() to ensure that
> it has everything you needed or malloc the argBuf and try again...
>
> As you have said, this patch is not a candidate for future versions of
> cvs, but I am sure there are a number of folks who will take advantage
> of your work, so do try to be a bit more paranoid.
I updated the files + my page according to your fine inputs. Thank you very
much for your comments.
/Claus