summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2003-08-24 21:36:38 -0400
committerTheodore Ts'o <tytso@mit.edu>2003-08-24 21:36:38 -0400
commit557ddb2fdf46c055d80c66267c8c83299527c8d1 (patch)
tree601d10121702a6435e409eb6aebcf1db4666f1d4
parenta7ac1df34fbed4c852d3227344e3dd0a69583013 (diff)
downloade2fsprogs-557ddb2fdf46c055d80c66267c8c83299527c8d1.tar.gz
util.c (get_backup_sb): Check to make sure the context is passed
in non-NULL before trying to dereference it. Otherwise we might core dump when called to expand %S in a problem description.
-rw-r--r--e2fsck/ChangeLog5
-rw-r--r--e2fsck/util.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 11df40fe..b5b9efa0 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,5 +1,10 @@
2003-08-24 Theodore Ts'o <tytso@mit.edu>
+ * util.c (get_backup_sb): Check to make sure the context is passed
+ in non-NULL before trying to dereference it. Otherwise we
+ might core dump when called to expand %S in a problem
+ description.
+
* e2fsck.8.in: Adjust description line so that apropos
"ext2" or "ext3" will find the man page. (Addresses
Debian Bug #206845)
diff --git a/e2fsck/util.c b/e2fsck/util.c
index 2c890dc6..8bb538d1 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -439,8 +439,11 @@ blk_t get_backup_sb(e2fsck_t ctx, ext2_filsys fs, const char *name,
ext2fs_swap_super(sb);
#endif
if (sb->s_magic == EXT2_SUPER_MAGIC) {
- ret_sb = ctx->superblock = superblock;
- ctx->blocksize = blocksize;
+ ret_sb = superblock;
+ if (ctx) {
+ ctx->superblock = superblock;
+ ctx->blocksize = blocksize;
+ }
break;
}
}