summaryrefslogtreecommitdiffstats
path: root/xlators/features/changelog
diff options
context:
space:
mode:
authorNandaja Varma <nvarma@redhat.com>2015-02-03 13:17:04 +0530
committerVenky Shankar <vshankar@redhat.com>2015-05-07 05:11:24 -0700
commite4c14bccb5abff6dcb8194b0da66dc1e73744256 (patch)
tree76067c8ad8e12ccbb33e851092267eb9db4772db /xlators/features/changelog
parent929bf9babfd538d9bb16daa8e66222c8a6c37be6 (diff)
changelog: Fixing buffer overrun coverity issues.
Coverity IDs: 1214630 1214631 1214633 1234643 Backport of: http://review.gluster.org/9557 Change-Id: I172c4f49bf651b2324522f9e661023f73ca05339 BUG: 789278 Signed-off-by: Nandaja Varma <nvarma@redhat.com> Reviewed-on: http://review.gluster.org/9557 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Sakshi Bansal Reviewed-by: Venky Shankar <vshankar@redhat.com> (cherry picked from commit 7d7b80efe8c745f3ff7de76fc31c4977098cae01) Reviewed-on: http://review.gluster.org/10595 Tested-by: NetBSD Build System Tested-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/features/changelog')
-rw-r--r--xlators/features/changelog/src/changelog-helpers.c2
-rw-r--r--xlators/features/changelog/src/changelog-misc.h12
2 files changed, 7 insertions, 7 deletions
diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c
index 0a29969..8dae5ef 100644
--- a/xlators/features/changelog/src/changelog-helpers.c
+++ b/xlators/features/changelog/src/changelog-helpers.c
@@ -313,7 +313,7 @@ htime_update (xlator_t *this,
ret = -1;
goto out;
}
- strcpy (changelog_path, buffer);
+ strncpy (changelog_path, buffer, PATH_MAX);
len = strlen (changelog_path);
changelog_path[len] = '\0'; /* redundant */
diff --git a/xlators/features/changelog/src/changelog-misc.h b/xlators/features/changelog/src/changelog-misc.h
index 6658552..acec6f6 100644
--- a/xlators/features/changelog/src/changelog-misc.h
+++ b/xlators/features/changelog/src/changelog-misc.h
@@ -83,14 +83,14 @@
} \
} while (0)
-#define CHANGELOG_FILL_HTIME_DIR(changelog_dir, path) do { \
- strcpy (path, changelog_dir); \
- strcat (path, "/htime"); \
+#define CHANGELOG_FILL_HTIME_DIR(changelog_dir, path) do { \
+ strncpy (path, changelog_dir, sizeof (path) - 1); \
+ strcat (path, "/htime"); \
} while(0)
-#define CHANGELOG_FILL_CSNAP_DIR(changelog_dir, path) do { \
- strcpy (path, changelog_dir); \
- strcat (path, "/csnap"); \
+#define CHANGELOG_FILL_CSNAP_DIR(changelog_dir, path) do { \
+ strncpy (path, changelog_dir, sizeof (path) - 1); \
+ strcat (path, "/csnap"); \
} while(0)
/**
* everything after 'CHANGELOG_TYPE_ENTRY' are internal types