| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH 6/8] xfs_fsr: check strdup results properly in initallfs() |
| From: | Eric Sandeen <sandeen@xxxxxxxxxx> |
| Date: | Sat, 26 Jan 2013 16:40:30 -0600 |
| Cc: | Eric Sandeen <sandeen@xxxxxxxxxx> |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1359240032-11576-1-git-send-email-sandeen@xxxxxxxxxx> |
| References: | <1359240032-11576-1-git-send-email-sandeen@xxxxxxxxxx> |
initallfs() does 2 strdups, but then checks the result
of one of them twice, rather then checking each one.
Fix this.
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---
fsr/xfs_fsr.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 843f57d..b5aa3db 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -470,10 +470,14 @@ initallfs(char *mtab)
fs->dev = strdup(mp->mnt_fsname);
fs->mnt = strdup(mp->mnt_dir);
- if (fs->mnt == NULL || fs->mnt == NULL) {
+ if (fs->dev == NULL) {
fsrprintf(_("strdup(%s) failed\n"), mp->mnt_fsname);
exit(1);
}
+ if (fs->mnt == NULL) {
+ fsrprintf(_("strdup(%s) failed\n"), mp->mnt_dir);
+ exit(1);
+ }
mi++;
fs++;
}
--
1.7.1
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 3/8] libxfs: fix setup_cursor array allocation, Eric Sandeen |
|---|---|
| Next by Date: | [PATCH 5/8] xfs_fsr: guard against path string overflows, Eric Sandeen |
| Previous by Thread: | [PATCH 3/8] libxfs: fix setup_cursor array allocation, Eric Sandeen |
| Next by Thread: | [PATCH 5/8] xfs_fsr: guard against path string overflows, Eric Sandeen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |