summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/util.c4
-rw-r--r--src/pacman/callback.c3
2 files changed, 5 insertions, 2 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;
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index f62d4449..7235d394 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -347,7 +347,8 @@ void cb_question(alpm_question_t event, void *data1, void *data2,
{
alpm_pgpkey_t *key = data1;
char created[12];
- strftime(created, 12, "%Y-%m-%d", localtime(&(key->created)));
+ time_t time = (time_t)key->created;
+ strftime(created, 12, "%Y-%m-%d", localtime(&time));
*response = yesno(_(":: Import PGP key %s, \"%s\", created %s?"),
key->fingerprint, key->uid, created);
}