fsck: don't free fstab table on parse failure
PATCH 1/1 fsck: don't free fstab table on parse failure
Even if we fail parsing, fstab gets referenced later in the code (and will subsequently crash via heap corruption). Take the easy way out and simply avoid deallocating this table, as it will be freed for us on program exit regardless.
---
Crash reproducible with 'FSTAB_FILE=/dev/null fsck <any-blockdev>'
disk-utils/fsck.c | 1 - 1 file changed, 1 deletion(-)
disk-utils/fsck.c +0 -1
@@ -430,7 +430,6 @@ static void load_fs_info(void) path =getenv ("FSTAB_FILE" );if (mnt_table_parse_fstab (fstab, path)) { -mnt_free_table (fstab);if (!path) path =mnt_get_fstab_path ();if (errno)
Signature · 1 line
1.7.9.4
Quoted 7 lines · Dave Reisner
Even if we fail parsing, fstab gets referenced later in the code (and will subsequently crash via heap corruption). Take the easy way out and simply avoid deallocating this table, as it will be freed for us on program exit regardless.
Signed-off-by Dave Reisner <[email protected]>---
Pinging this, as it doesn't seem it was merged...
d
Quoted 20 lines
Crash reproducible with 'FSTAB_FILE=/dev/null fsck <any-blockdev>'
disk-utils/fsck.c | 1 - 1 file changed, 1 deletion(-)disk-utils/fsck.c +0
-1@@ -430,7 +430,6 @@ static void load_fs_info(void) path =getenv ("FSTAB_FILE" );if (mnt_table_parse_fstab (fstab, path)) { -mnt_free_table (fstab);if (!path) path =mnt_get_fstab_path ();if (errno)Signature · 1 line
1.7.9.4
Quoted 10 lines · Dave Reisner
Quoted 7 lines · Dave Reisner
Even if we fail parsing, fstab gets referenced later in the code (and will subsequently crash via heap corruption). Take the easy way out and simply avoid deallocating this table, as it will be freed for us on program exit regardless.
Signed-off-by Dave Reisner <[email protected]>---
Pinging this, as it doesn't seem it was merged...
Sorry, somehow marked as applied in my u-l mail folder, but not applied in git.
Applied, thanks.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com