mlocate: fix crash on aarch64-musl

Current code call canonicalize_file_name without prior declaration in
system with musl libc. Thus the return value of canonicalize_file_name
is truncated from char* to int.

Use realpath instead.
Fix #25531
This commit is contained in:
Đoàn Trần Công Danh 2020-10-26 22:39:12 +07:00
parent 92f33ebfe6
commit a7b2cc8497
2 changed files with 10 additions and 1 deletions

View File

@ -8,3 +8,12 @@
#include <mntent.h> #include <mntent.h>
#include "error.h" #include "error.h"
@@ -388,7 +389,7 @@
char *dir;
#ifndef PROC_MOUNTS_PATH
- dir = canonicalize_file_name (me->mnt_dir);
+ dir = realpath (me->mnt_dir, NULL);
if (dir == NULL)
dir = me->mnt_dir;
#else

View File

@ -1,7 +1,7 @@
# Template file for 'mlocate' # Template file for 'mlocate'
pkgname=mlocate pkgname=mlocate
version=0.26 version=0.26
revision=4 revision=5
build_style=gnu-configure build_style=gnu-configure
configure_args="--program-prefix=m --localstatedir=/var/lib" configure_args="--program-prefix=m --localstatedir=/var/lib"
make_build_args="groupname=_mlocate" make_build_args="groupname=_mlocate"