* bug: disk/mkfs crashes in libdisk when given a directory as a protofile
@ 2018-09-19 3:42 Nick Owens
2018-10-12 10:11 ` Nick Owens
0 siblings, 1 reply; 2+ messages in thread
From: Nick Owens @ 2018-09-19 3:42 UTC (permalink / raw)
To: 9front
the following command will crash:
disk/mkfs -a -o .
with a null pointer dereference in libdisk, in the proto file parser.
obviously it is wrong to pass a directory as a protofile to mkfs, but
it was an accident on my part.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: bug: disk/mkfs crashes in libdisk when given a directory as a protofile
2018-09-19 3:42 bug: disk/mkfs crashes in libdisk when given a directory as a protofile Nick Owens
@ 2018-10-12 10:11 ` Nick Owens
0 siblings, 0 replies; 2+ messages in thread
From: Nick Owens @ 2018-10-12 10:11 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
this bug was introduced in revision c7027d120f0c. attached is a diff
which prevents this crash in libdisk. any thoughts?
On Tue, Sep 18, 2018 at 8:42 PM Nick Owens <mischief@offblast.org> wrote:
>
> the following command will crash:
>
> disk/mkfs -a -o .
>
> with a null pointer dereference in libdisk, in the proto file parser.
>
> obviously it is wrong to pass a directory as a protofile to mkfs, but
> it was an accident on my part.
[-- Attachment #2: libdisk.patch --]
[-- Type: text/x-patch, Size: 338 bytes --]
diff --git a/sys/src/libdisk/proto.c b/sys/src/libdisk/proto.c
--- a/sys/src/libdisk/proto.c
+++ b/sys/src/libdisk/proto.c
@@ -537,7 +537,10 @@ loop:
goto loop;
p--;
popopt(mkaux);
- *strchr(p, '\n') = 0;
+ s = strchr(p, '\n');
+ if(s == nil)
+ return nil;
+ *s = 0;
if(s = strchr(p, '=')){
*s++ = 0;
setopt(mkaux, p, s);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-12 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 3:42 bug: disk/mkfs crashes in libdisk when given a directory as a protofile Nick Owens
2018-10-12 10:11 ` Nick Owens
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).