1 |
commit: ab51b5e60db69f6ee6f2513fef7ce12ebc01af92 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 3 11:44:40 2019 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 3 11:44:40 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ab51b5e6 |
7 |
|
8 |
libq/cache: fix crash when a category contains a non-directory |
9 |
|
10 |
Bug: https://bugs.gentoo.org/684252 |
11 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
12 |
|
13 |
libq/cache.c | 5 +++++ |
14 |
1 file changed, 5 insertions(+) |
15 |
|
16 |
diff --git a/libq/cache.c b/libq/cache.c |
17 |
index 9993002..0dbf483 100644 |
18 |
--- a/libq/cache.c |
19 |
+++ b/libq/cache.c |
20 |
@@ -160,6 +160,11 @@ cache_next_pkg(cache_cat_ctx *cat_ctx) |
21 |
|
22 |
ctx->ebuilddir_cat_ctx = |
23 |
q_vdb_open_cat(pkgdir, ctx->ebuilddir_pkg_ctx->name); |
24 |
+ |
25 |
+ /* opening might fail if what we found wasn't a |
26 |
+ * directory or something */ |
27 |
+ if (ctx->ebuilddir_cat_ctx == NULL) |
28 |
+ return NULL; |
29 |
} |
30 |
|
31 |
ret = q_vdb_next_pkg(ctx->ebuilddir_cat_ctx); |