diff options
author | Dan McGee <dan@archlinux.org> | 2008-11-30 17:17:00 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-11-30 17:17:00 -0600 |
commit | b99bebc008dcf944a88f99bb44ac9029557e4149 (patch) | |
tree | ee1695ff661d08c0f5421afaa83ae0488fa3c777 /lib/libalpm/be_files.c | |
parent | a50b067470a8046dabdff66f6266d2208b2f8372 (diff) | |
download | pacman-b99bebc008dcf944a88f99bb44ac9029557e4149.tar.xz |
Add regex to delta code so we don't segfault when reading line
If the delta line doesn't match our regex, we won't go and process it,
possibly walking off the end of the string.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_files.c')
-rw-r--r-- | lib/libalpm/be_files.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index 0658a661..b9ff6464 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -618,7 +618,10 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) _alpm_strtrim(line); if(strcmp(line, "%DELTAS%") == 0) { while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) { - info->deltas = alpm_list_add(info->deltas, _alpm_delta_parse(line)); + pmdelta_t *delta = _alpm_delta_parse(line); + if(delta) { + info->deltas = alpm_list_add(info->deltas, delta); + } } } } |