How long does it take for buttermilk to go bad?
Buttermilk is already thoroughly packed with live bacteria. During its manufacture, that bacteria already consumed some portion of the available lactose and turned it into lactic acid.

Because of the lack of food, acidity, and the extreme competition it is pretty hard for buttermilk to go bad. The good bacteria will stay active and the buttermilk will get thicker and more sour until it runs out of lactose. In fact- when your buttermilk container has about 1/2 cup left you can make more just by refilling the container with milk and leaving it to ferment on the counter for a day. If you use it up more quickly than the bacteria eat the lactose then you can keep this up indefinitely.

Don't worry if it is thicker- if it still smells good then it probably is. As Noctrine said- mold around the lip is the worst risk. I am not a food chemist and despite my personal experience- if you ever suspect that food is bad just throw it out. $2 of buttermilk isn't worth an unpleasant afternoon.