Fix potential stack overflow and add security notice to readme