summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-17 20:37:40 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-17 20:37:40 (EST)
commite3f3fb8c73124f354fadf11ee7fe0d0b5e358763 (patch)
tree90769a1857a3963511c709e3a37b5140722f4158 /libopkg
parent98acf192dfcde709aeee5eb8cbaea806e84a6d42 (diff)
Fix segfault while attempting to parse invalid package stream.
Reported by John L. Chmielewski. git-svn-id: http://opkg.googlecode.com/svn/trunk@331 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/pkg_parse.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libopkg/pkg_parse.c b/libopkg/pkg_parse.c
index 246705e..a51a3e1 100644
--- a/libopkg/pkg_parse.c
+++ b/libopkg/pkg_parse.c
@@ -152,6 +152,7 @@ pkg_parse_line(pkg_t *pkg, const char *line, uint mask)
{
/* these flags are a bit hackish... */
static int reading_conffiles = 0, reading_description = 0;
+ int ret = 0;
switch (*line) {
case 'A':
@@ -279,12 +280,14 @@ pkg_parse_line(pkg_t *pkg, const char *line, uint mask)
parse_conffiles(pkg, line);
goto dont_reset_flags;
}
- break;
+ /* FALLTHROUGH */
default:
/* For package lists, signifies end of package. */
- if(line_is_blank(line))
- return 1;
+ if(line_is_blank(line)) {
+ ret = 1;
+ break;
+ }
}
reading_description = 0;
@@ -292,7 +295,7 @@ pkg_parse_line(pkg_t *pkg, const char *line, uint mask)
dont_reset_flags:
- return 0;
+ return ret;
}
int