freebsd-dev/module
Ned Bass 7b2d78a046 Fix improper null-byte termination handling
Fix a few cases where null-byte termination of strings was done
unnecessarily or incorrectly.

- The snprintf() function always produces a null-byte terminated string
  for non-negative return values, so it is not necessary to write out a
  null-byte as a separate step.

- Also, it is unsafe to use the return value of snprintf() as an offset
  for placing a null-byte, because if the output was truncated the return
  value is the number of bytes that _would_ have been written had enough
  space been available. Therefore the return value may index beyond the
  array boundaries.

- Finally, snprintf() accounts for the null-byte when limiting its output
  size, so there is no need to pass it a size parameter that is one less
  than the buffer size.

Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2875
2014-11-17 15:28:59 -08:00
..
avl Add module versioning 2013-12-06 09:34:41 -08:00
nvpair Fix nvlist 'Bus Error' for Sparc 2014-01-09 15:50:15 -08:00
unicode cstyle: Resolve C style issues 2013-12-18 16:46:35 -08:00
zcommon Implement -t option to zpool create for temporary pool names 2014-09-30 10:46:59 -07:00
zfs Fix improper null-byte termination handling 2014-11-17 15:28:59 -08:00
zpios Update code to use misc_register()/misc_deregister() 2014-10-17 14:58:44 -07:00
.gitignore gitignore: anchor entries at their respective directory 2013-04-02 10:50:17 -07:00
Makefile.in Fix modules installation directory 2014-10-28 09:46:14 -07:00