Previous company went through source code audit during acquisition. Auditor inevitably found code from Stack Overflow. Their guidance, which got us a passing grade, was to just include links to the SO answer and link to CC in a nearby comment in the code.
This is not legal advice, just sharing our story.