Skip to content

Commit

Permalink
CA-220467: Destination buffer too small
Browse files Browse the repository at this point in the history
CID-28073 Added check to make sure destination buffer is big enaugh
for the name wich is going to be copied in.

Signed-off-by: Stefano Panella <stefano.panella@citrix.com>
Reviewed-By: Mark Syms <mark.syms@citrix.com>
  • Loading branch information
stefanopanella authored and germanop committed Nov 15, 2016
1 parent 7911d72 commit d5d7049
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/tapdisk-nbdserver.c
Expand Up @@ -834,6 +834,14 @@ tapdisk_nbdserver_listen_unix(td_nbdserver_t *server)
}

server->local.sun_family = AF_UNIX;

if (unlikely(strlen(server->sockpath) >
(sizeof(server->local.sun_path) - 1))) {
err = -ENAMETOOLONG;
ERR("socket name too long: %s\n", server->sockpath);
goto out;
}

strcpy(server->local.sun_path, server->sockpath);
err = unlink(server->local.sun_path);
if (err == -1 && errno != ENOENT) {
Expand Down

0 comments on commit d5d7049

Please sign in to comment.