Just the oxygen in their backpacks, and they had to get back before it ran out. In lunar excursions, then they never went further than a distance they could walk back safely in case the rover broke down. So they would start by traveling out as far as they could safely go (obviously the safe distance goes down as the oxygen runs down) and then drive back towards the lunar module as their air supply diminished stopping to explore in several stages on the way in.
They did have emergency backup in the form of the "oxygen purge system" integrated into their spacesuit in case the main system failed, which gave them up to 90 minutes of emergency oxygen.
Also a buddy system which they could use if the cooling system for their spacesuit failed, they could hook up their spacesuit to their buddy so that his cooling system cooled down both spacesuits (it was a major issue keeping cool enough in the Apollo spacesuits).
They were of course taking calculated risks all the way through, I mean we all take risks, for instance driving a car, taking a bus, even walking has some risks associated with it But obviously they accepted a higher risk than usual on the Moon.
Just to take an example, the astronauts stumbled and fell several times in the lunar gravity - a bad fall which damaged their spacesuit for instance, could have killed them. And many pieces of equipment that had to work to keep them alive, each with a tiny probability of failure.