| To: | Eric Sandeen <sandeen@xxxxxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx> |
|---|---|
| Subject: | [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated |
| From: | Eric Sandeen <sandeen@xxxxxxxxxxx> |
| Date: | Fri, 06 Jun 2014 16:03:10 -0500 |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <53922B49.1050005@xxxxxxxxxx> |
| References: | <53922B49.1050005@xxxxxxxxxx> |
| User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
Ensure that the string we read from leftofffile is NULL
terminated; the buffer gets passed to strchr(), so
it's important that we ensure it ends with NULL.
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 3818f02..94d235c 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -554,6 +554,8 @@ fsrallfs(char *mtab, int howlong, char *leftofffile)
fsrprintf(_("could not read %s, starting with %s\n"),
leftofffile, *fs->dev);
} else {
+ /* Ensure the buffer we read is null terminated */
+ buf[SMBUFSZ-1] = '\0';
for (fs = fsbase; fs < fsend; fs++) {
fsname = fs->dev;
if ((strncmp(buf,fsname,strlen(fsname)) == 0)
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 0/3] xfs_fsr robustification, Eric Sandeen |
|---|---|
| Next by Date: | [PATCH 2/3] xfs_fsr: create a cleanup/return target in packfile(), Eric Sandeen |
| Previous by Thread: | [PATCH 0/3] xfs_fsr robustification, Eric Sandeen |
| Next by Thread: | Re: [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated, Brian Foster |
| Indexes: | [Date] [Thread] [Top] [All Lists] |