From d12c4f4b29458ff04671bf7b9686735ad988c775 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 10 Jul 2007 14:31:39 -0400 Subject: Fix issue with /db.lck being truncated snprintf takes a length including the '\0' character, this wasn't accounted for originally. Fix it. Signed-off-by: Dan McGee --- lib/libalpm/handle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 759c14cf..e45be016 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -174,8 +174,8 @@ void SYMEXPORT alpm_option_set_dbpath(const char *dbpath) _alpm_log(PM_LOG_DEBUG, "option 'dbpath' = %s", handle->dbpath); const char *lf = "db.lck"; - int lockfilelen = strlen(handle->dbpath) + strlen(lf); - handle->lockfile = calloc(lockfilelen + 1, sizeof(char)); + int lockfilelen = strlen(handle->dbpath) + strlen(lf) + 1; + handle->lockfile = calloc(lockfilelen, sizeof(char)); snprintf(handle->lockfile, lockfilelen, "%s%s", handle->dbpath, lf); _alpm_log(PM_LOG_DEBUG, "option 'lockfile' = %s", handle->lockfile); } -- cgit v1.2.3-24-g4f1b