]> git.wh0rd.org Git - dump.git/commitdiff
Restrict usage on -e option (prevent array overflow with many -e and prevent excludin...
authorStelian Pop <stelian@popies.net>
Fri, 1 Sep 2000 14:39:21 +0000 (14:39 +0000)
committerStelian Pop <stelian@popies.net>
Fri, 1 Sep 2000 14:39:21 +0000 (14:39 +0000)
CHANGES
dump/main.c

diff --git a/CHANGES b/CHANGES
index 6ca6bb17f64786fb837189be37902ee4bbcc3cb0..699c1f548d3027c8d420f78fa26d558be1d90a0f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.81 2000/09/01 14:26:23 stelian Exp $
+$Id: CHANGES,v 1.82 2000/09/01 14:39:21 stelian Exp $
 
 Changes between versions 0.4b19 and 0.4b20 (released ???????????????)
 =====================================================================
@@ -21,6 +21,11 @@ Changes between versions 0.4b19 and 0.4b20 (released ???????????????)
        directory. Thanks to John R. Dennison 
        <gerdesas@users.sourceforge.net> for reporting the bug.
 
+4.     Fixed the '-e' option to disable the possibility
+       to exclude the root inode (which causes the dumps to
+       be unreadable by restore). Prevented array overflow
+       when multiple -e options are used.
+
 Changes between versions 0.4b18 and 0.4b19 (released August 20, 2000)
 =====================================================================
 
index 43c31168f070429dbb8f7a3d7830c15d6ec20e7b..eac1f5baad11fdea07589273ef5b15d370c9742b 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.24 2000/08/20 19:41:50 stelian Exp $";
+       "$Id: main.c,v 1.25 2000/09/01 14:40:27 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -202,8 +202,15 @@ main(int argc, char *argv[])
                        
                                        /* 04-Feb-00 ILC */
                case 'e':               /* exclude an inode */
-                       iexclude_list[iexclude_num++] = 
-                         numarg("inode to exclude",0L,0L);
+                       if (iexclude_num == IEXCLUDE_MAXNUM) {
+                               (void)fprintf(stderr, "Too many -e options\n");
+                               exit(X_STARTUP);
+                       }
+                       iexclude_list[iexclude_num++] = numarg("inode to exclude",0L,0L);
+                       if (iexclude_list[iexclude_num-1] <= ROOTINO) {
+                               (void)fprintf(stderr, "Cannot exclude inode %d\n", iexclude_list[iexclude_num-1]);
+                               exit(X_STARTUP);
+                       }
                        msg("Added %d to exclude list\n",
                            iexclude_list[iexclude_num-1]);
                        break;