Skip to content
Snippets Groups Projects
  • Nick Mathewson's avatar
    959da6b7
    Use strlcpy in create_unix_sockaddr() · 959da6b7
    Nick Mathewson authored
    Using strncpy meant that if listenaddress were ever >=
    sizeof(sockaddr_un.sun_path), we would fail to nul-terminate
    sun_path.  This isn't a big deal: we never read sun_path, and the
    kernel is smart enough to reject the sockaddr_un if it isn't
    nul-terminated.  Nonetheless, it's a dumb failure mode.  Instead, we
    should reject addresses that don't fit in sockaddr_un.sun_path.
    
    Coverity found this; it's CID 428.  Bugfix on 0.2.0.3-alpha.
    959da6b7
    History
    Use strlcpy in create_unix_sockaddr()
    Nick Mathewson authored
    Using strncpy meant that if listenaddress were ever >=
    sizeof(sockaddr_un.sun_path), we would fail to nul-terminate
    sun_path.  This isn't a big deal: we never read sun_path, and the
    kernel is smart enough to reject the sockaddr_un if it isn't
    nul-terminated.  Nonetheless, it's a dumb failure mode.  Instead, we
    should reject addresses that don't fit in sockaddr_un.sun_path.
    
    Coverity found this; it's CID 428.  Bugfix on 0.2.0.3-alpha.