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