Detailed paperwork. And keep all your receipts and paperwork. Seriously. For life.
We've had a few incidents with clients and stock photography. The most recent involved a client who purchased a web template from Template Monster, and a couple years later got a a notice that some of the pictures that were included with it were not licensed. They tried to sock him for several thousand dollars, and Template Monster was no help at all.
The first one happened to a client who had us scan pictures out of one of their brochures for their website - over ten years ago. Then, ten years later, they get a bill from someone for over $20,000 for use of the photos. They'd had some design firm create the original brochure for them, and turned out the design firm had not had legal rights to the photos. They were out of business, we'd also purchased some stock photography for the site, and it was so long ago nobody still had a brochure or remembered which photos were obtained where. It was a real mess. By the time we figured out what was what, the client did have to settle with photographer for some amount that I wasn't privy to.