Article View: news.software.nntp
Article #92569Re: innd SERVER cant malloc 18446744073699012160 bytes
From: Richard Kettlewell
Date: Tue, 18 Nov 2025 23:19
Date: Tue, 18 Nov 2025 23:19
75 lines
4397 bytes
4397 bytes
richard@cogsci.ed.ac.uk (Richard Tobin) writes:
> Russ Allbery <eagle@eyrie.org> wrote:
>>I am still a bit confused, though, because the value of groupslen doesn't
>>seem to be something sensible like -2. If I'm doing the math correctly,
>>it's something more like -10539456, which is a hard value to justify if
>>the problem is the above bug.
>
> The number in hex is 0xffffffffff5f2e40, and the non-f part
> corresponds to the printable characters _.@ which is hardly conclusive
> but might be due to being overwritten by a malformed mail address.
The proximate code is:
static bool
MatchGroups(const char *g, int len, const char *pattern, bool exactmatch)
{
char *group, *groups, *q;
int i, lastwhite;
enum uwildmat matched;
bool wanted = false;
q = groups = xmalloc(len + 1);
This is consistent with len = -10539457.
The length comes from ARTstore:
if (innconf->storeonxref) {
arth.groups = data->Replic;
arth.groupslen = data->ReplicLength;
} else {
arth.groups = HDR(HDR__NEWSGROUPS);
arth.groupslen = HDR_LEN(HDR__NEWSGROUPS);
}
I donāt think Jesseās said what storeonxref is set to but the default is
true, so Iām going to assume thatās what it is until I hear otherwise.
ReplicLength is set in ARTassignnumbers, which is the kind of ad-hoc
string builder that tends to be full of bugs. It has a number of issues
but the most relevant is:
* If the collection of group names (and article numbers etc) adds up to
more than 2GB then len will overflow to negative. This could explain
the outcome seen, although it would need a pathologically large input
article.
Other observations about ARTassignnumbers, which I donāt think can
explain the behavior seen:
* A pathhost bigger than the default xref buffer size (2049 bytes) would
generate a buffer overflow.
* An article number longer than ARTNUMPRINTSIZE could fail to expand the
buffer when needed. Currently you get ten digits, and the starting
buffer size is 2049 bytes, so this is probably not an issue in
real life.
* If there are no groups at all then the buffer expansion never happens
at all, so nothing explicitly accounts for the CRLF at the end -
i.e. the commented assumption āchecked during the reallocation aboveā
is violated. But the default buffer size is more than enough in that
case.
* p and len are tracked separately, which is pointless and invites
error, but I donāt see any way to get them out of sync apart from the
overflow issue described above.
* ReplicLength is set in an unnecessarily complicated way, because
len - (q + 1 - data->Xref) == Path.used - 1
but I donāt see any realistic way for that to end up negative or for
q+1 to run past the end of the buffer.
--
https://www.greenend.org.uk/rjk/
Technical Details
Message-ID:
<wwvecpvhqu2.fsf@LkoBDZeT.terraraq.uk>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!abo001.abavia.com!feed.abavia.com!abr001.abavia.com!abn001.abavia.com!2.eu.feeder.erje.net!feeder.erje.net!feeds.news.ox.ac.uk!news.ox.ac.uk!nntp-feed.chiark.greenend.org.uk!ewrotcd!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mailReferences:
<10fenue$2qr8$1@nnrp.usenet.blueworldhosting.com> <10fi0nt$3uqp2$1@news.trigofacile.com> <87tsyrf9ag.fsf@hope.eyrie.org> <10fijgb$qokl$1@artemis.inf.ed.ac.uk>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!abo001.abavia.com!feed.abavia.com!abr001.abavia.com!abn001.abavia.com!2.eu.feeder.erje.net!feeder.erje.net!feeds.news.ox.ac.uk!news.ox.ac.uk!nntp-feed.chiark.greenend.org.uk!ewrotcd!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: Richard Kettlewell <invalid@invalid.invalid>
Newsgroups: news.software.nntp
Subject: Re: innd SERVER cant malloc 18446744073699012160 bytes
Date: Tue, 18 Nov 2025 23:19:01 +0000
Organization: terraraq NNTP server
Message-ID: <wwvecpvhqu2.fsf@LkoBDZeT.terraraq.uk>
References: <10fenue$2qr8$1@nnrp.usenet.blueworldhosting.com>
<10fi0nt$3uqp2$1@news.trigofacile.com> <87tsyrf9ag.fsf@hope.eyrie.org>
<10fijgb$qokl$1@artemis.inf.ed.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="20557"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:XJutsoc+tBBvohj1akMReWMIeuE=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO