Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix errors due to bad strncpy behavour.
As of GCC 8.1 a compiler error (stringop-truncation) will be raised as strncpy has potentially unsafe behavour, which is the case here. If strncpy's source (path in our case) is longer than the destination the destination will not be null terminated. Which is what sockaddr_un requires of sockaddr_un.sun_path. By reducing the copy size by one ensures as much as path as can be copied is and pads the rest of destination (the remaining one character) with null bytes, ensuring it's properly null terminated.
- Loading branch information