diff options
author | 2019-12-27 22:44:46 +0100 | |
---|---|---|
committer | 2019-12-27 22:44:46 +0100 | |
commit | eddd1df90bc5d27e726c02e8aac8cfa9484ed3a8 (patch) | |
tree | 9ece9a04fda6632173169a866c4e279cbd6708bf /qfile.c | |
parent | libq/atom: fix crash in atom_compare on invalid input (diff) | |
download | portage-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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'; } |