Coverity is claiming getenv is returning a tainted string and I've exhausted all of my ideas for return value checking. I looked at the other questions similar to mine, but none of their solutions worked for me.
I've tried checking the return for NULL, I've tried strdup, strncpy, memcpy and nothing seems to make the tainted string go away.
Here's the original code without the checks that didn't work:
void my_func()
{
for(int port = 0; port < NUM_PORTS; port++) {
download_id_table(port,getenv("ID_FILE")); //tainted string from getenv
}
download_info(getenv("INFO_FILE")); //tainted string from getenv
//...
}
Any ideas on how I can get Coverity to believe it's no longer tainted?