bug-cvs
[Top][All Lists]
Advanced

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

Re: unitialized buffer used in error situation


From: Derek Robert Price
Subject: Re: unitialized buffer used in error situation
Date: Mon, 29 Sep 2003 14:45:46 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1

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

Mark D. Baushke wrote:

|Derek Robert Price <address@hidden> writes:
|A missing label2 is not as much of a problem as that will be filled in
|by the file2 argument that is sent later. If both label1 and label2 are
|NULL, then it is not a problem. If label1 is not NULL and label2 is NULL,
|then that is not a problem.
|
|Does the following code make sense?
|
|    if (label1 && label2)
|    {
|    call_diff_arg (label1);
|    call_diff_arg (label2);
|    }
|    else if (label1)
|    {
|    call_diff_arg (label1);
|    }
|    else if (label2)
|    {
|    call_diff_arg ("-L<unknown-file>\t<unknown-date>");
|    call_diff_arg (label2);
|    }


Actually, no.  I just traced the issue farther and it is possible to
want label2 set and not label1.  When the user has specified a single -L
option, then the -L argument to diff is stored in the global opts string
and have_rev1_label is set.  When CVS notices that have_rev2_label is
not set, it calls make_file_label for rev2 and sets label2 without
setting label1.

The problem arises when the user does not pass in a -L argument and
make_file_label returns NULL for rev1.

Anyhow, I think the correct fix is to prohibit make_file_label from
returning NULL, even when the stat fails to determine the date on the
file.  I toyed with the idea of returning a label of simply "-L<path>"
since the path to the file is available within make_file_label and I
verified that a label without a date is still acceptable to patch, but I
decided to make the stat failure a fatal error since I think it unlikely
that the stat will fail and the later file read necessary to perform the
diff will not.

I'm running this through `make check' and should commit it soon.

Derek

- --
~                *8^)

Email: address@hidden

Get CVS support at <http://ximbiot.com>!
- --
"It's difficult to work in a group when you're omnipotent."

   -Q, "Deja Q"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org

iD8DBQE/eH3YLD1OTBfyMaQRAkxzAKC3Ql0Jrxe45EYOaoXJyNiz/hhQjwCgpqK/
YCNnmvV1PdykTDdnJR9qiJI=
=l1zp
-----END PGP SIGNATURE-----






reply via email to

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