=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/from/from.c,v retrieving revision 1.25 retrieving revision 1.26 diff -c -r1.25 -r1.26 *** src/usr.bin/from/from.c 2017/05/31 19:41:30 1.25 --- src/usr.bin/from/from.c 2018/08/08 17:52:46 1.26 *************** *** 1,4 **** ! /* $OpenBSD: from.c,v 1.25 2017/05/31 19:41:30 millert Exp $ */ /* $NetBSD: from.c,v 1.6 1995/09/01 01:39:10 jtc Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: from.c,v 1.26 2018/08/08 17:52:46 deraadt Exp $ */ /* $NetBSD: from.c,v 1.6 1995/09/01 01:39:10 jtc Exp $ */ /* *************** *** 74,83 **** } argv += optind; ! if (pledge("stdio rpath getpw", NULL) == -1) err(1, "pledge"); file = mail_spool(file, *argv); if ((fp = fopen(file, "r")) == NULL) { if (!fflag && errno == ENOENT) exit(EXIT_SUCCESS); --- 74,89 ---- } argv += optind; ! if (pledge("stdio unveil rpath getpw", NULL) == -1) err(1, "pledge"); file = mail_spool(file, *argv); + + if (unveil(file, "r") == -1) + err(1, "unveil"); + if (pledge("stdio rpath getpw", NULL) == -1) + err(1, "pledge"); + if ((fp = fopen(file, "r")) == NULL) { if (!fflag && errno == ENOENT) exit(EXIT_SUCCESS);