Document the provenance of every piece of code. Make a list of any third-party code you use, open source or proprietary, and a copy of the licenses.<p>At the top of each source file, make a comment with the name of the author, a copyright notice, and a pointer to your license file. If you've used version control since day 1, it can help you determine where your code comes from.<p>That should take care of copyright infringement.<p>Trademark and patent infringement might require hiring a lawyer to perform searches of relevant databases. This is going to be time-consuming and expensive for patents, and you may well end up infringing because of the awful situation of software patents. My best advice is to not mention patents and hope the customer doesn't bring up the issue.<p>I read somewhere that there's a ruling in the US that, unless you're a patent attorney, a court must presume that you don't know how to understand patents. And if you read a patent and incorrectly conclude that you don't infringe, that makes you aware that you infringe, and negligent because you didn't seek the advice of a patent attorney, and you're automatically liable for triple damages. But if you hadn't read the patent, you're only liable for single damages.<p>So it's better never to read any patents, ever, and pray you don't infringe, or if you do, that the patent holder isn't going to notice you until you're big enough to fight back.