aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2019-12-27 22:44:46 +0100
committerFabian Groffen <grobian@gentoo.org>2019-12-27 22:44:46 +0100
commiteddd1df90bc5d27e726c02e8aac8cfa9484ed3a8 (patch)
tree9ece9a04fda6632173169a866c4e279cbd6708bf /qfile.c
parentlibq/atom: fix crash in atom_compare on invalid input (diff)
downloadportage-utils-eddd1df90bc5d27e726c02e8aac8cfa9484ed3a8.tar.gz
portage-utils-eddd1df90bc5d27e726c02e8aac8cfa9484ed3a8.tar.bz2
portage-utils-eddd1df90bc5d27e726c02e8aac8cfa9484ed3a8.zip
qfile: make qfile_check_plibreg not trigger on an empty file (/)v0.83
This really is an edge case, as result of a misinterpretation of the -R option. Bug: https://bugs.gentoo.org/699558 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'qfile.c')
-rw-r--r--qfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/qfile.c b/qfile.c
index 6c2ebb85..b1aab8d1 100644
--- a/qfile.c
+++ b/qfile.c
@@ -119,7 +119,7 @@ static int qfile_check_plibreg(void *priv)
}
for (i = 0; i < args->length; i++) {
- if (base_names[i] == NULL)
+ if (base_names[i] == NULL || base_names[i][0] == '\0')
continue;
if (non_orphans && non_orphans[i])
continue;
@@ -534,7 +534,7 @@ int qfile_main(int argc, char **argv)
* (this one is just for qfile(...) output) */
size_t lastc = strlen(portroot) - 1;
state.root = xstrdup(portroot);
- if (state.root[lastc] == '/')
+ if (lastc > 0 && state.root[lastc] == '/')
state.root[lastc] = '\0';
}