Skip to content
Snippets Groups Projects
Commit 74b750cd authored by Timo Teräs's avatar Timo Teräs
Browse files

info: fix -W with symlinks

readlink does not null terminate the link target

(cherry picked from commit f5c3fd84)
parent ef994626
No related branches found
No related tags found
No related merge requests found
Pipeline #290210 passed
...@@ -110,7 +110,7 @@ static void info_who_owns(struct info_ctx *ctx, struct apk_database *db, ...@@ -110,7 +110,7 @@ static void info_who_owns(struct info_ctx *ctx, struct apk_database *db,
if (pkg == NULL) { if (pkg == NULL) {
r = readlinkat(db->root_fd, *parg, buf, sizeof(buf)); r = readlinkat(db->root_fd, *parg, buf, sizeof(buf));
if (r > 0 && r < PATH_MAX && buf[0] == '/') { if (r > 0 && r < PATH_MAX && buf[0] == '/') {
pkg = apk_db_get_file_owner(db, APK_BLOB_STR(buf)); pkg = apk_db_get_file_owner(db, APK_BLOB_PTR_LEN(buf, r));
via = "symlink target "; via = "symlink target ";
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment