9front - general discussion about 9front
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] upas/Mail: fix multiple suicides (use after free, double free) in mbox.c (patch)
Date: Mon, 12 Apr 2021 17:51:09 +0200	[thread overview]
Message-ID: <C8511E7F52CB0889A13607B3C4600519@felloff.net> (raw)
In-Reply-To: <6C9435B0EAB3ECBB65041EE29A4AA82D@9lab.org>

thats idiotic. if you only zero the entries that you free,
you can still have valid pointers after index mbox.nmesg.

if you want really zero all unused entries, you can do it
unconditionally after reading, or just add a second loop
like:

	...
}

mbox.nmesg = j;
while(j < i) mbox.mesg[j++] = nil;

// or use memset?
// memset(&mbox.mesg[j], 0, (i-j)*sizeof(mbox.mesg[0]));

but really, i do not think it is neccesary... tho it can
help when trying to find memory leaks and avoid these
false references.

--
cinap

      reply	other threads:[~2021-04-12 15:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11 20:19 igor
2021-04-12  2:59 ` ori
2021-04-12 12:49   ` igor
2021-04-12 15:51     ` cinap_lenrek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C8511E7F52CB0889A13607B3C4600519@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).