This will depend on the type of sale. If you are purchasing the assets of a business, you will not be purchasing the company’s debts- unless this is agreed upon during negotiation. If, however, you are purchasing the company’s stocks, you are taking on all seller debts and obligations.
The most important way to protect yourself when buying a business is to conduct a thorough due diligence with the help of a professional such as a lawyer or accountant so that you know exactly what you are taking on when you purchase the business.
If you want further protection, you can have the seller sign an indemnity agreement.