[Swan-commit] Changes to ref refs/heads/master

D. Hugh Redelmeier hugh at vault.libreswan.fi
Thu Aug 24 16:52:45 UTC 2017


New commits:
commit 501bbbf58ea2179a7316156c2d82fa3fc2159411
Author: D. Hugh Redelmeier <hugh at mimosa.com>
Date:   Thu Aug 24 12:42:28 2017 -0400

    pervasive: tame remaining calls to strncpy()
    
    - strncpy is rarely the right thing to do
    
    - for pure NUL-padding, strncpy is fine.  But that is rarely used in C
      and when it is used, code is often buggy
    
    - for pure NUL-termination, jam_str is best.
    
    - for safety, we NUL-terminate everything that is NUL-padded.  The
      only problem is that the longest representable strings are one
      character shorter.
    
    - too few datastructures document whether NUL-padding or
      NUL-termination is required so we do both.  For example,
      if I remember correctly, BSD requires network interface
      names to be NUL-padded and Linux requires NUL-termination.



More information about the Swan-commit mailing list