blob: 3e0de57389ae22fb2170da2267864839d39007e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
commit 022cc07e4140c1ba1b9824124b29f36fd44d6040
Author: William Cohen <wcohen@redhat.com>
Date: Mon May 23 14:59:41 2011 -0500
Ensure that --save only saves things in $SESSION_DIR
diff --git a/utils/opcontrol b/utils/opcontrol
index e908f1f..0f04354 100644
--- a/utils/opcontrol
+++ b/utils/opcontrol
@@ -75,6 +75,16 @@ error_if_not_number()
fi
}
+# check value is a base filename
+error_if_not_basename()
+{
+ bname=`basename "$2"`
+ if [[ "x$2" != "x$bname" ]] ; then
+ echo "Argument for $1, $2, is not a base filename." >&2
+ exit 1
+ fi
+}
+
# rm_device arguments $1=file_name
rm_device()
{
@@ -753,6 +763,7 @@ do_options()
--save)
error_if_empty $arg $val
+ error_if_not_basename $arg $val
DUMP=yes
SAVE_SESSION=yes
SAVE_NAME=$val
|