9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: andrey mirtchovski <andrey@lanl.gov>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] 4th edition file server available
Date: Tue, 14 Jan 2003 08:20:07 -0700	[thread overview]
Message-ID: <20030114080254.R93707-100000@fbsd.acl.lanl.gov> (raw)
In-Reply-To: <932e2dcf6c7cc416329e51ff3789f75d@plan9.bell-labs.com>

On Mon, 13 Jan 2003, Russ Cox wrote:

> There are no buffer overflows anyway.  ;-)


I see the smiley, but have to reply anyway. this is not a nasty jab
at Russ, just a fix (I hope :)

there's a buffer overflow in cpu.c (strcpy):

% cpu -h `{perl -e '{print "A"x100;}'}
cpu 116986: suicide: sys: trap: fault read addr=0x19000 pc=0x00005b8b
plan9% acid 116986
/proc/116986/text:386 plan 9 executable

/sys/lib/acid/port
/sys/lib/acid/386
acid: stk()
At pc:0x00005b8b:fmtfmt+0x1f /sys/src/libc/fmt/fmt.c:63
fmtfmt(c=0x00000073) /sys/src/libc/fmt/fmt.c:57
        called from _fmtdispatch+0x83 /sys/src/libc/fmt/fmt.c:175
_fmtdispatch(isrunes=0x00000000,f=0x7fffeb48,fmt=0x000168b6) /sys/src/libc/fmt/fmt.c:113
        called from dofmt+0x75 /sys/src/libc/fmt/dofmt.c:62
dofmt(fmt=0x000168b4,f=0x7fffeb48) /sys/src/libc/fmt/dofmt.c:7
        called from vsnprint+0x62 /sys/src/libc/fmt/vsnprint.c:20
vsnprint(len=0x00000100,buf=0x00018734,args=0x7fffebac,fmt=0x000168b0) /sys/src/libc/fmt/vsnprint.c:5
        called from snprint+0x2b /sys/src/libc/fmt/snprint.c:13
snprint(fmt=0x000168b0,buf=0x00018734,len=0x00000100) /sys/src/libc/fmt/snprint.c:5
        called from netmkaddr+0x5e /sys/src/libc/port/netmkaddr.c:34
netmkaddr(linear=0x00017e0c,defnet=0x00000000,defsrv=0x00016978) /sys/src/libc/port/netmkaddr.c:10
        called from rexcall+0x28 /sys/src/cmd/cpu.c:347
rexcall(host=0x00017e0c,service=0x00016978,fd=0x7fffed98) /sys/src/cmd/cpu.c:339
        called from main+0x132 /sys/src/cmd/cpu.c:147
main(argv=0x7fffef84,argc=0x00000000) /sys/src/cmd/cpu.c:77
        called from _main+0x31 /sys/src/libc/386/main9.s:16
acid:


----------------------

here's the fix:

plan9% diff cpu.c /sys/src/cmd/cpu.c
121c121
<               strncpy(system, p, sizeof system);
---
>               strcpy(system, p);
plan9% 8c cpu.c; 8l cpu.8
plan9% 8.out -h `{perl -e '{print "A"x100}'}
cpu: can't dial: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: cs: can't translate address
plan9%







  reply	other threads:[~2003-01-14 15:20 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-13 10:01 Richard Miller
2003-01-13 17:13 ` Russ Cox
2003-01-14 15:20   ` andrey mirtchovski [this message]
2003-01-14 18:55     ` Scott Schwartz
2003-01-14 19:11       ` andrey mirtchovski
2003-01-14 19:18         ` andrey mirtchovski
2003-01-14 19:28         ` Russ Cox
2003-01-15  9:34           ` Douglas A. Gwyn
2003-01-15 14:22             ` Russ Cox
2003-01-13 17:19 ` rob pike, esq.
  -- strict thread matches above, loose matches on Subject: below --
2003-02-10 21:06 Andrey S. Kukhar
2003-01-14 19:13 Russ Cox
2003-01-14 18:23 Skip Tavakkolian
2003-01-14  6:06 okamoto
2003-01-14 13:55 ` David Presotto
2003-02-14 16:04 ` Andrey S. Kukhar
2003-01-12  2:36 Joel Salomon
2003-01-12  3:10 ` jmk
2003-01-09 13:44 rog
2003-01-09 14:39 ` Russ Cox
2003-01-08  8:13 okamoto
2003-01-08 16:56 ` Russ Cox
2003-01-08  7:18 Skip Tavakkolian
2003-01-08  6:45 Russ Cox
2003-01-08 11:09 ` Axel Belinfante
2003-01-08 15:57   ` Fco.J.Ballesteros
2003-01-08 15:56 ` andrey mirtchovski
2003-01-08 16:53   ` Russ Cox
2003-01-08 22:52 ` Andrew
2003-01-08 22:54   ` Russ Cox
2003-01-09  8:24     ` Fco.J.Ballesteros
2003-01-09 13:16 ` Axel Belinfante
2002-11-06 17:37 [9fans] ddc Russ Cox
2002-11-06 17:50 ` andrey mirtchovski
2002-11-06 19:33   ` Scott Schwartz
2002-11-06 20:39 ` Jim Choate
2002-11-07  3:17   ` Doc Shipley
2002-11-07  4:57     ` Jim Choate
2002-11-07  5:39       ` Lucio De Re
2002-11-07  5:45       ` Doc Shipley
2002-11-07  6:08         ` Jim Choate
2002-11-07  4:21 ` Lucio De Re
2002-11-07  8:24 ` paurea
2002-10-15  1:20 [9fans] EHLO EHLO presotto
2002-10-15 16:23 ` Dan Cross
2002-10-15 16:47   ` Anthony Mandic
2002-10-15 22:22     ` Nigel Roles
2002-10-15 23:05       ` andrey mirtchovski
2002-10-16  7:12         ` Steve Kilbane
2002-10-17  9:48           ` Boyd Roberts
2002-10-16  8:54         ` Anthony Mandic

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=20030114080254.R93707-100000@fbsd.acl.lanl.gov \
    --to=andrey@lanl.gov \
    --cc=9fans@cse.psu.edu \
    /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).