commit 87a818e80dd7b59d2ee3f9b1cdffc82d7c5c1b4c from: Omar Polo date: Tue Dec 14 22:32:36 2021 UTC ensure we don't call openat(2) with "" as path commit - cf758c3329364c1516e2b78c573d6901843bc670 commit + 87a818e80dd7b59d2ee3f9b1cdffc82d7c5c1b4c blob - 5acf852dec04af7440d6eb40c4a8f159f7f7a8b4 blob + 5519c0909c9c72e32d8fc7455e1aa62bc156dfe0 --- client.c +++ client.c @@ -1053,6 +1053,7 @@ topen(struct np_msg_header *hdr, const uint8_t *data, struct fid *f; uint32_t fid; uint8_t mode; + const char *path; /* fid[4] mode[1] */ if (!NPREAD32("fid", &fid, &data, &len) || @@ -1083,7 +1084,11 @@ topen(struct np_msg_header *hdr, const uint8_t *data, return; } - if ((f->fd = openat(f->qid->fd, f->qid->fpath, f->iomode)) == -1) { + path = f->qid->fpath; + if (*path == '\0') + path = "."; + + if ((f->fd = openat(f->qid->fd, path, f->iomode)) == -1) { np_error(hdr->tag, strerror(errno)); return; }