Also NUL terminate string in error case #30714

This commit is contained in:
Marc André Tanner 2015-02-16 22:44:29 +01:00
parent 5c7f933dcc
commit bb7c859b5f
1 changed files with 1 additions and 0 deletions

View File

@ -249,6 +249,7 @@ static bool set_socket_name(struct sockaddr_un *sockaddr, const char *name) {
if (name[0] == '/') {
strncpy(sockaddr->sun_path, name, maxlen);
if (sockaddr->sun_path[maxlen-1]) {
sockaddr->sun_path[maxlen-1] = '\0';
errno = ENAMETOOLONG;
return false;
}