* [9front] [patch] aux/acpi use emalloc9p
@ 2023-01-13 17:07 Arne Meyer
0 siblings, 0 replies; only message in thread
From: Arne Meyer @ 2023-01-13 17:07 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 133 bytes --]
Hello,
aux/acpi uses malloc/realloc without checking the return value.
Use emalloc9p/erealloc9p and bail out early.
Greetings,
Arne
[-- 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 @@
amlinit();
for(;;){
- t = malloc(sizeof(*t));
+ t = emalloc9p(sizeof(*t));
if((n = readn(fd, t, Tblsz)) <= 0)
break;
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){
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-13 17:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 17:07 [9front] [patch] aux/acpi use emalloc9p Arne Meyer
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).