From 834ba4da932f9e196e06baf724e0bd379092ded5 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 21 Mar 2011 08:52:24 -0500 Subject: Fix line_offset not being reset in _alpm_archive_fgets() This is a rather serious data corruption issue that luckily manifested itself today in a noticable way. A package in testing had replaces entries read in as ["%RE pkgname", "%RE"] which was clearly wrong. This happens when we hit the end of an archive block, do not have a newline, and have to continue reading from the next block to complete the line. Signed-off-by: Dan McGee --- lib/libalpm/util.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/libalpm') diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 74e14058..11e69041 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -740,6 +740,9 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b) int64_t offset; int done = 0; + /* ensure we start populating our line buffer at the beginning */ + b->line_offset = b->line; + while(1) { /* have we processed this entire block? */ if(b->block + b->block_size == b->block_offset) { -- cgit v1.2.3-54-g00ecf