3e8a942 Don't abuse strncpy() length limitation

Authored and Committed by cheimes 5 years ago
    Don't abuse strncpy() length limitation
    
    On two occasions C code abused strncpy()'s length limitation to copy a
    string of known length without the trailing NULL byte. Recent GCC is
    raising the compiler warning:
    
      warning: ‘strncpy’ output truncated before terminating nul copying as
      many bytes from a string as its length [-Wstringop-truncation]
    
    Use memcpy() instead if strncpy() to copy data of known size.
    
    See: https://pagure.io/freeipa/issue/7738
    Signed-off-by: Christian Heimes <cheimes@redhat.com>
    Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
    
        
file modified
+1 -1