Towards Safer Code Reuse: Investigating And Mitigating Security Vulnerabilities And License Violations In Copy-Based Reuse Scenarios