Article View: news.software.nntp
Article #93020Re: INN snapshots
From: Julien ÉLIE
Date: Thu, 06 Aug 2026 22:06
Date: Thu, 06 Aug 2026 22:06
33 lines
2638 bytes
2638 bytes
Hi Russ,
>> - if (sb.st_size < 0 || sb.st_size > UINT_MAX) {
>> + if (sb.st_size < 0 || (unsigned int) sb.st_size > UINT_MAX) {
>
>
> This is a weird check and I don't entirely understand the point of it
This check was added to harden the validation of article size when
opening the (tradspool) file, and fail before mmap'ing it in case its
size is totally abnormal. It should not occur on normal operations (no
article of that size is ever written) but may if the spool was tampered
(and there is enough capacity on the disk to store the article).
https://github.com/InterNetNews/inn/commit/4b7f6862e88514deabb97ecc5bc814d11a1ffb56#diff-91414faa9de6f861d80330fdc6e3effb03cb905fe879b0e6aebc2ea734b662d6
> sb.st_size is off_t which can be longer than unsigned int (and I think
> *can* even be larger than unsigned long since it could be a signed long
> long), so doing the cast that way risks overflow and a false negative on
> the comparison, I think. Instead, I think you want:
>
> if (sb.st_size < 0 || sb.st_size > (off_t) UINT_MAX) {
Yes indeed, thanks for noticing.
--
Julien ÉLIE
« – Nous ne connaissons pas leur langue, donc, sous aucun prétexte il ne
faut parler aux Goths !
– Mais on peut leur taper dessus ? » (Astérix)
Technical Details
Message-ID:
<11530i1$7cko$1@news.trigofacile.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!news.trigofacile.com!.POSTED.2001:861:3f81:7990:8076:34f0:89a6:213f!not-for-mailReferences:
<11523nj$13ag$8@gallifrey.nk.ca> <1152jlp$742n$1@news.trigofacile.com> <87bjbfys3j.fsf@hope.eyrie.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!news.trigofacile.com!.POSTED.2001:861:3f81:7990:8076:34f0:89a6:213f!not-for-mail From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> Newsgroups: news.software.nntp Subject: Re: INN snapshots Date: Fri, 7 Aug 2026 00:06:57 +0200 Organization: Groupes francophones par TrigoFACILE Message-ID: <11530i1$7cko$1@news.trigofacile.com> References: <11523nj$13ag$8@gallifrey.nk.ca> <1152jlp$742n$1@news.trigofacile.com> <87bjbfys3j.fsf@hope.eyrie.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 6 Aug 2026 22:06:57 -0000 (UTC) Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="2001:861:3f81:7990:8076:34f0:89a6:213f"; logging-data="242328"; mail-complaints-to="abuse@trigofacile.com" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:RTa3VkObdHVq3VQdIkzmUd7K6mg= sha256:pvmgsgEfDj+deo/HOdyYlVtraPG9CqM1hDJigU4D/5k= sha1:y4lA+TQVZn3d8SX1Q3Uzaoy8Yzk= sha256:2MiY3Pye6fN4KUf47kxsoCpYE0y8G9Z2FjytebuzWiw= In-Reply-To: <87bjbfys3j.fsf@hope.eyrie.org>