9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Arne Meyer <meyer.arne83@netcologne.de>
To: "9front@9front.org" <9front@9front.org>
Subject: [9front] [patch] aux/acpi use emalloc9p
Date: Fri, 13 Jan 2023 18:07:02 +0100 (CET)	[thread overview]
Message-ID: <572386095.2056265.1673629622228@comcenter.netcologne.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 133 bytes --]


aux/acpi uses malloc/realloc without checking the return value.
Use emalloc9p/erealloc9p and bail out early.


[-- Attachment #2: acpi.patch --]
[-- Type: application/octet-stream, Size: 514 bytes --]

diff c10be29c773737c4159b613f4f6c3b5a90d732f6 uncommitted
--- a/sys/src/cmd/aux/acpi.c
+++ b/sys/src/cmd/aux/acpi.c
@@ -431,7 +431,7 @@
-		t = malloc(sizeof(*t));
+		t = emalloc9p(sizeof(*t));
 		if((n = readn(fd, t, Tblsz)) <= 0)
 		if(n != Tblsz)
@@ -440,7 +440,7 @@
 		if(l < Tblsz)
 			goto fail;
 		l -= Tblsz;
-		t = realloc(t, sizeof(*t) + l);
+		t = erealloc9p(t, sizeof(*t) + l);
 		if(readn(fd, t->data, l) != l)
 			goto fail;
 		if(memcmp("DSDT", t->sig, 4) == 0){

                 reply	other threads:[~2023-01-13 17:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

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

  git send-email \
    --in-reply-to=572386095.2056265.1673629622228@comcenter.netcologne.de \
    --to=meyer.arne83@netcologne.de \
    --cc=9front@9front.org \


* 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).