From: Aki Tuomi Date: Wed, 28 Oct 2020 10:22:58 +0000 (+0200) Subject: lib-storage: raw-mail - Cast st_size to uoff_t X-Git-Tag: 2.3.13~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=edb32ea0e8cfcf3c76f30f7a59ab84b8ec349fc2;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: raw-mail - Cast st_size to uoff_t mbox->size is unsigned field, and st_size will be -1 is the stat target is not regular file or symbolic link. This can happen if it's stream like stdin. --- diff --git a/src/lib-storage/index/raw/raw-mail.c b/src/lib-storage/index/raw/raw-mail.c index 23143c33d9..b8bbb87cd9 100644 --- a/src/lib-storage/index/raw/raw-mail.c +++ b/src/lib-storage/index/raw/raw-mail.c @@ -31,7 +31,7 @@ static int raw_mail_stat(struct mail *mail) mbox->mtime = st->st_mtime; if (mbox->ctime != (time_t)-1) mbox->ctime = st->st_ctime; - mbox->size = st->st_size; + mbox->size = (size_t)st->st_size; return 0; }