git » libjio » commit a97577e

jmove_journal(): Fix malloc() size miscalculation

author Alberto Bertogli
2009-08-04 16:10:21 UTC
committer Alberto Bertogli
2009-08-04 16:49:51 UTC
parent d1e28a78c769b3a6e0ef8e556abf7d1311eee152

jmove_journal(): Fix malloc() size miscalculation

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

libjio/trans.c +1 -1

diff --git a/libjio/trans.c b/libjio/trans.c
index 16ca3d6..f8aa491 100644
--- a/libjio/trans.c
+++ b/libjio/trans.c
@@ -648,7 +648,7 @@ int jmove_journal(struct jfs *fs, const char *newpath)
 	oldpath = fs->jdir;
 	snprintf(oldjlockfile, PATH_MAX, "%s/lock", fs->jdir);
 
-	fs->jdir = (char *) malloc(strlen(newpath + 1));
+	fs->jdir = (char *) malloc(strlen(newpath) + 1);
 	if (fs->jdir == NULL)
 		return -1;
 	strcpy(fs->jdir, newpath);