Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2019-12-16 18:01:31 +00:00
4 changed files with 87 additions and 71 deletions

View File

@ -2026,10 +2026,10 @@ server_client_dispatch_read_data(struct client *c, struct imsg *imsg)
struct msg_read_data *msg = imsg->data;
size_t msglen = imsg->hdr.len - IMSG_HEADER_SIZE;
struct client_file find, *cf;
void *bdata = msg->data;
size_t bsize = msg->size;
void *bdata = msg + 1;
size_t bsize = msglen - sizeof *msg;
if (msglen != sizeof *msg)
if (msglen < sizeof *msg)
fatalx("bad MSG_READ_DATA size");
find.stream = msg->stream;
if ((cf = RB_FIND(client_files, &c->files, &find)) == NULL)
@ -2113,19 +2113,3 @@ server_client_get_cwd(struct client *c, struct session *s)
return (home);
return ("/");
}
/* Resolve an absolute path or relative to client working directory. */
char *
server_client_get_path(struct client *c, const char *file)
{
char *path, resolved[PATH_MAX];
if (*file == '/')
path = xstrdup(file);
else
xasprintf(&path, "%s/%s", server_client_get_cwd(c, NULL), file);
if (realpath(path, resolved) == NULL)
return (path);
free(path);
return (xstrdup(resolved));
}