Coverity warning: strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);

Alfred Perlstein alfred at freebsd.org
Sat May 1 22:35:35 UTC 2010


I notice this code sprinkled through the sources:
  strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);

This trips up coverity because it does not know for sure
that the string returned by cam_sim_name() is going to 
be DEV_IDLEN-1 characters long.

Should we switch these calls to strlcpy?  Is there a smarter
thing to do to code more defensively?

thank you,
-- 
- Alfred Perlstein
.- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10
.- FreeBSD committer


More information about the freebsd-hackers mailing list