summaryrefslogtreecommitdiff
path: root/usr.bin/cu/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/cu/command.c')
-rw-r--r--usr.bin/cu/command.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/cu/command.c b/usr.bin/cu/command.c
index 9ae8e9adf9c..c07fe73aeca 100644
--- a/usr.bin/cu/command.c
+++ b/usr.bin/cu/command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: command.c,v 1.15 2015/10/05 23:15:31 nicm Exp $ */
+/* $OpenBSD: command.c,v 1.16 2017/12/10 01:03:46 deraadt Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org>
@@ -28,6 +28,7 @@
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include "cu.h"
@@ -222,6 +223,11 @@ start_record(void)
void
do_command(char c)
{
+ if (restricted && strchr("CRX$>", c) != NULL) {
+ cu_warnx("~%c command is not allowed in restricted mode", c);
+ return;
+ }
+
switch (c) {
case '.':
case '\004': /* ^D */