The term of the lease follows with the new owner even if the home/building is sold.
Here's a little more about Tenants rights....
Tenants have basic legal rights that are always present no matter what the rental agreement or lease states. These rights include all of the following:
Limits on the amount of the security deposit that the landlord can require you to pay (see Basic Rules Governing Security Deposits).
Limits on the landlord's right to enter the rental unit (see When Can the Landlord Enter the Rental Unit) .
The right to a refund of the security deposit, or a written accounting of how it was used, after you move (See Refunds of Security Deposits).
The right to sue the landlord for violations of the law or your rental agreement or lease.
The right to repair serious defects in the rental unit and to deduct certain repair costs from the rent, under appropriate circumstances (see Repair and Deduct Remedy).
The right to withhold rent under appropriate circumstances (see Rent Withholding Remedy).
Rights under the warranty of habitability (See Repairs and Habitability).
Protection against retaliatory eviction.