1 |
commit: 45f8462493056b8ca0634ac0c8942c171deee075 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Dec 29 02:22:06 2016 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Dec 29 02:22:06 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=45f84624 |
7 |
|
8 |
cache: add sanity check on malformed cache files |
9 |
|
10 |
main.c | 4 ++++ |
11 |
1 file changed, 4 insertions(+) |
12 |
|
13 |
diff --git a/main.c b/main.c |
14 |
index 33db01a..d124695 100644 |
15 |
--- a/main.c |
16 |
+++ b/main.c |
17 |
@@ -1215,6 +1215,10 @@ cache_read_file_pms(const char *file) |
18 |
next_line(EAPI, PROPERTIES) |
19 |
#undef next_line |
20 |
ptr = strchr(ptr+1, '\n'); |
21 |
+ if (ptr == NULL) { |
22 |
+ warn("Invalid cache file '%s' - could not find end of cache data", file); |
23 |
+ goto err; |
24 |
+ } |
25 |
*ptr = '\0'; |
26 |
|
27 |
fclose(f); |