bug-cvs
[Top][All Lists]
Advanced

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

Re: different CVS_SERVER for different hosts


From: Mark D. Baushke
Subject: Re: different CVS_SERVER for different hosts
Date: Wed, 29 Oct 2003 08:49:44 -0800

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

Mihai Bazon <address@hidden> writes:

> On Wed, 2003-10-29 at 11:57, Mark D. Baushke wrote:
> > I sent private code review comments to Mihai, but it is worth noting one
> > that is a 'security' concern. Do not assume that the file is not
> > a zero-length file. Check that the len > 0 before potentially changing
> > '\n' bytes into '\0' bytes at the end of it.
> 
> Sorry to have to contradict you about the above.  My code looks like
> this:
> 
>             char *res = fgets(buf, sizeof(buf), f);
>             fclose(f);
>             if (!res)
>                 // forget it
>                 break;
> 
> For a zero-length file fgets returns NULL so we exit before removing the
> last newline character.

Oops. Yes, it does. I should know better than to do a very fast
code-review when I am tired. :-)

> Breaking C89 guidelines is, well, something I usually don't care..  I am
> a former C++ programmer and this gave me some real bad habits--or good,
> depends on how you're seeing it ;-)

Well, if it does not work with a freestanding C89, then the patch will
not work for a lot of people. If the intent is to share something
useful, I would hope the idea would be to share it with as many people
as possible... in a useful state.

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

iD8DBQE/n++n3x41pRYZE/gRAq+KAJ94ZjJ8MuLugC5if5lcIrAk0XQqIwCdEn2H
WUh0VZrI5EfCHvBXn2+sQ6o=
=T1V8
-----END PGP SIGNATURE-----




reply via email to

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