mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
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 <dan@archlinux.org>
This commit is contained in:
parent
b0bb4f9024
commit
834ba4da93
@ -740,6 +740,9 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b)
|
|||||||
int64_t offset;
|
int64_t offset;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
|
/* ensure we start populating our line buffer at the beginning */
|
||||||
|
b->line_offset = b->line;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
/* have we processed this entire block? */
|
/* have we processed this entire block? */
|
||||||
if(b->block + b->block_size == b->block_offset) {
|
if(b->block + b->block_size == b->block_offset) {
|
||||||
|
Loading…
Reference in New Issue
Block a user