<PAGE>

                                  Exhibit 4.02

                          AMENDMENT TO RIGHTS AGREEMENT


         This is an Amendment to the Rights Agreement dated as of July 17, 1997
(the "Rights Agreement"), between Valero Energy Corp., formerly known as Valero
Refining and Marketing Co. (the "Company"), Harris Trust and Savings Bank
("Harris"), and Computershare Investor Services, LLC, ("Computershare").

                                   WITNESSETH

         WHEREAS, the Company and Harris previously entered into the Rights
Agreement, pursuant to which Harris was appointed to serve as the Rights Agent
under the Rights Agreement;

         WHEREAS, effective June 30, 2000, Computershare succeeded to the stock
transfer business of Harris, as a result of which , pursuant to Section 19 of
the Rights Agreement, Computershare became the Rights Agent for purposes of the
Rights Agreement;

         WHEREAS, the parties wish to amend the Rights Agreement to the extent
necessary to reflect such succession;

         WHEREAS, the Company and Computershare previously entered into
Amendment No. 1 to the Rights Agreement, pursuant to which the Company and
Computershare amended the Rights Agreement in contemplation of a merger between
the Company and UDS;

         NOW, THEREFORE, in consideration of the premises and the mutual
agreements herein set forth, the parties hereby agree as follows:

         Section 1. Amendment of Rights Agreement. Effective as of the date of
appointment of Computershare as successor Rights Agent, the Rights Agreement
shall be amended as follows:

         (a) Section 26 of the Rights Agreement is hereby amended by deleting
         the address for notice or demand to be given to the Rights Agent
         therein and substituting in lieu thereof the following:

                  "Computershare Investor Services, LLC
                  Two North LaSalle Street
                  Chicago, Illinois 60602
                  Attention:  Keith Bradley"

         (b) All references in the Rights Agreement to "Harris Trust and Savings
         Bank" as Rights Agent shall for all purposes be deemed to refer to
         "Computershare Investor Services, LLC."


                                       1
<PAGE>



         (c) Section 21 of the Rights Agreement is hereby amended by deleting
         the sentence that begins on page 36 with "Any successor Rights Agent. .
         . ." and ends on page 37 with ". . . combined capital and surplus of at
         least $50 million," and submitting in lieu thereof the following
         sentence:

                  Any successor Rights Agent, whether appointed by the Company
                  or by such a court, shall be (a) a corporation, limited
                  liability company or trust company (or similar form of entity
                  under the laws of any state of the United States or a foreign
                  jurisdiction) authorized to conduct business under the laws of
                  the United States or any state of the United States, which is
                  authorized under such laws to exercise corporate trust or
                  stockholder services powers and is subject to supervision or
                  examination by federal or state authority and which has at the
                  time of its appointment as Rights Agent a combined capital and
                  surplus of at least $10,000,000 or (b) an Affiliate controlled
                  by an entity described in clause (a) of this sentence.

         Section 3. Rights Agreement as Amended. The term "Agreement" as used in
the Rights Agreement shall be deemed to refer to the Rights Agreement as amended
hereby. This Amendment shall be effective as of June 30, 2000, and, except as
set forth herein, the Rights Agreement shall remain in full force and effect and
otherwise shall be unaffected hereby.

         Section 4. This Amendment shall be deemed to be a contract made under
the laws of the State of Delaware and for all purposes shall be governed by and
construed in accordance with the laws of such State applicable to contracts to
be made and performed entirely within such State.

         Section 5. This Amendment may be executed in any number of counterparts
and each of such counterparts shall for all purposes be deemed to be an
original, and all such counterparts shall together constitute but one and the
same instrument.

         Section 6. If any term, provision, covenant or restriction of this
Amendment is held by a court of competent jurisdiction or other authority to be
invalid, void or unenforceable, the remainder of the terms, provisions,
covenants and restrictions of this Amendment, and of the Rights Agreement, shall
remain in full force and effect and shall in no way be affected, impaired or
invalidated.

         Section 7. Except as otherwise expressly provided herein, or unless the
context otherwise requires, all terms used herein have the meanings assigned to
them in the Rights Agreement.





                                      * * *


                                       2
<PAGE>


         IN WITNESS WHEREOF, the parties hereto have caused this Amendment to be
duly executed as of the day and year above written.

                                          VALERO ENERGY CORP.

                                          By:      /s/ Jay D. Browning
                                             -----------------------------------
                                          Name:      Jay D. Browning
                                               ---------------------------------
                                          Title:   Vice President and Secretary
                                                --------------------------------


                                          HARRIS TRUST AND SAVINGS BANK

                                          By:      /s/ Martin J. McHale
                                             -----------------------------------
                                          Name:    Martin J. McHale
                                               ---------------------------------
                                          Title:   Vice President
                                                --------------------------------


                                          COMPUTERSHARE INVESTOR
                                          SERVICES, LLC

                                          By:      /s/ Keith A. Bradley
                                             -----------------------------------
                                          Name:    Keith A. Bradley
                                               ---------------------------------
                                          Title:   Director, Client Services
                                                --------------------------------


                                       3