Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-10-13 16:25:21 -0500
committerDan McGee <dan@archlinux.org>2011-10-13 16:25:21 -0500
commit53e525c4f3a6b0bfdc346b4563c6c8fc0e1b5b11 (patch)
tree19a338424c13f17723486a690c5b97babca92fd4 /lib/libalpm/util.c
parentff8704635440fe890ac8621722cc8301a3875e48 (diff)
Fix some strict 32-bit gcc warnings
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 43f6cd52..0d499ad4 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -960,7 +960,9 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b)
b->line_size = b->block_size + 1;
b->line_offset = b->line;
} else {
- size_t new = eol ? (eol - b->block_offset) : block_remaining;
+ /* note: we know eol > b->block_offset and b->line_offset > b->line,
+ * so we know the result is unsigned and can fit in size_t */
+ size_t new = eol ? (size_t)(eol - b->block_offset) : block_remaining;
size_t needed = (size_t)((b->line_offset - b->line) + new + 1);
if(needed > b->max_line_size) {
b->ret = -ERANGE;