-/* $OpenBSD: ldapd.c,v 1.29 2021/07/14 13:33:57 kn Exp $ */
+/* $OpenBSD: ldapd.c,v 1.30 2021/12/15 04:00:15 deraadt Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
if (imsg->hdr.len != sizeof(*oreq) + IMSG_HEADER_SIZE)
fatal("invalid size of open request");
- /* make sure path is null-terminated */
- oreq->path[PATH_MAX] = '\0';
+ if (oreq->path[PATH_MAX-1] != '\0')
+ fatal("bogus path");
if (strncmp(oreq->path, datadir, strlen(datadir)) != 0) {
log_warnx("refusing to open file %s", oreq->path);
-/* $OpenBSD: ldapd.h,v 1.35 2021/04/20 21:11:56 dv Exp $ */
+/* $OpenBSD: ldapd.h,v 1.36 2021/12/15 04:00:15 deraadt Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
};
struct open_req {
- char path[PATH_MAX+1];
+ char path[PATH_MAX];
unsigned int rdonly;
};
-/* $OpenBSD: ldape.c,v 1.34 2021/04/20 21:11:56 dv Exp $ */
+/* $OpenBSD: ldape.c,v 1.35 2021/12/15 04:00:15 deraadt Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
if (imsg->hdr.len != sizeof(*oreq) + IMSG_HEADER_SIZE)
fatal("invalid size of open result");
- /* make sure path is null-terminated */
- oreq->path[PATH_MAX] = '\0';
+ if (oreq->path[PATH_MAX-1] != '\0')
+ fatal("bogus path");
log_debug("open(%s) returned fd %d", oreq->path, imsg->fd);