Skip to content

Commit

Permalink
auth_pts: make sure socket fname will fit in buffer
Browse files Browse the repository at this point in the history
Fixes #1434
  • Loading branch information
elliefm committed Jun 28, 2017
1 parent 129d3ae commit a5f3762
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/auth_pts.c
Expand Up @@ -430,6 +430,13 @@ static int ptload(const char *identifier, struct auth_state **state)
fname = tofree;
}

if (strlen(fname) >= sizeof(srvaddr.sun_path)) {
syslog(LOG_ERR, "ptload(): socket filename %s too long for " SIZE_T_FMT "-byte buffer",
fname, sizeof(srvaddr.sun_path));
rc = -1;
goto done;
}

memset((char *)&srvaddr, 0, sizeof(srvaddr));
srvaddr.sun_family = AF_UNIX;
strcpy(srvaddr.sun_path, fname);
Expand Down

0 comments on commit a5f3762

Please sign in to comment.