From: Stelian Pop Date: Fri, 1 Sep 2000 14:39:21 +0000 (+0000) Subject: Restrict usage on -e option (prevent array overflow with many -e and prevent excludin... X-Git-Tag: release_0_4b20~11 X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=commitdiff_plain;h=aec13b2a483076d0d31256729c3602143993bf63 Restrict usage on -e option (prevent array overflow with many -e and prevent excluding of inodes <= 2). --- diff --git a/CHANGES b/CHANGES index 6ca6bb1..699c1f5 100644 --- 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 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) ===================================================================== diff --git a/dump/main.c b/dump/main.c index 43c3116..eac1f5b 100644 --- a/dump/main.c +++ b/dump/main.c @@ -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 @@ -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;