mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-10 11:35:00 -05:00
Fix issue with <dbpath>/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 <dan@archlinux.org>
This commit is contained in:
parent
ea1fef69ad
commit
d12c4f4b29
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user