mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-10 11:35:00 -05:00
fix off-by-one error in _alpm_filelist_resolve
'/' should not be appended to the resolved root when root is "/". Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
d5a5a6b512
commit
bc747fbfbf
@ -198,12 +198,16 @@ int _alpm_filelist_resolve(alpm_handle_t *handle, alpm_filelist_t *files)
|
||||
if(realpath(handle->root, path) == NULL){
|
||||
return -1;
|
||||
}
|
||||
root_len = strlen(path) + 1;
|
||||
if(root_len >= PATH_MAX) {
|
||||
root_len = strlen(path);
|
||||
if(root_len + 1 >= PATH_MAX) {
|
||||
return -1;
|
||||
}
|
||||
path[root_len - 1] = '/';
|
||||
/* append '/' if root is not "/" */
|
||||
if(path[root_len - 1] != '/') {
|
||||
path[root_len] = '/';
|
||||
root_len++;
|
||||
path[root_len] = '\0';
|
||||
}
|
||||
|
||||
ret = _alpm_filelist_resolve_link(files, &i, path, root_len, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user