diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 59d539c6..0e216b6d 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -466,7 +466,7 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg, size_t pkg_current, size_t pkg_count) { int i, ret = 0, errors = 0; - char scriptlet[PATH_MAX+1]; + char scriptlet[PATH_MAX]; int is_upgrade = 0; pmpkg_t *oldpkg = NULL; pmdb_t *db = handle->db_local; diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 89214707..dc067290 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -363,7 +363,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, for(current = 0, i = upgrade; i; i = i->next, current++) { alpm_list_t *k, *tmpfiles = NULL; pmpkg_t *p1, *p2, *dbpkg; - char path[PATH_MAX+1]; + char path[PATH_MAX]; p1 = i->data; if(!p1) { @@ -480,9 +480,9 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, } if(!resolved_conflict && dbpkg) { - char *rpath = calloc(PATH_MAX+1, sizeof(char)); + char *rpath = calloc(PATH_MAX, sizeof(char)); if(!realpath(path, rpath)) { - FREE(rpath); + free(rpath); continue; } char *filestr = rpath + strlen(handle->root); diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 80ad5601..730372a7 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -328,7 +328,7 @@ enum _pmerrno_t _alpm_set_directory_option(const char *value, if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) { return PM_ERR_NOT_A_DIR; } - real = calloc(PATH_MAX + 1, sizeof(char)); + real = calloc(PATH_MAX, sizeof(char)); if(!realpath(path, real)) { free(real); return PM_ERR_NOT_A_DIR; diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 27305ae3..a4b60cf4 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -186,7 +186,7 @@ int _alpm_remove_prepare(pmhandle_t *handle, alpm_list_t **data) static int can_remove_file(pmhandle_t *handle, const char *path, alpm_list_t *skip) { - char file[PATH_MAX+1]; + char file[PATH_MAX]; snprintf(file, PATH_MAX, "%s%s", handle->root, path); @@ -215,7 +215,7 @@ static void unlink_file(pmhandle_t *handle, pmpkg_t *info, char *filename, alpm_list_t *skip_remove, int nosave) { struct stat buf; - char file[PATH_MAX+1]; + char file[PATH_MAX]; snprintf(file, PATH_MAX, "%s%s", handle->root, filename); diff --git a/src/pacman/conf.c b/src/pacman/conf.c index b16be044..512eade0 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -512,7 +512,7 @@ static int _parseconfig(const char *file, int parse_options, char **section, pmdb_t *db) { FILE *fp = NULL; - char line[PATH_MAX+1]; + char line[PATH_MAX]; int linenum = 0; char *ptr; int ret = 0; diff --git a/src/pacman/query.c b/src/pacman/query.c index d1105b4a..9e81e26d 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -40,7 +40,7 @@ static char *resolve_path(const char *file) { char *str = NULL; - str = calloc(PATH_MAX + 1, sizeof(char)); + str = calloc(PATH_MAX, sizeof(char)); if(!str) { return NULL; }