9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] IOHDRSZ
@ 2013-04-04 19:50 erik quanstrom
  2013-04-04 20:14 ` Charles Forsyth
  0 siblings, 1 reply; 3+ messages in thread
From: erik quanstrom @ 2013-04-04 19:50 UTC (permalink / raw)
  To: 9fans

i wonder if  the typical use of IOHDRSZ is correct.

many programs set
	msize = bufsize + IOHDRSIZE
but Twrite has 2+4+8+4=18 bytes overhead, so
i think this assumption is going to lead to
6-byte buffer overruns.

- erik



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] IOHDRSZ
  2013-04-04 19:50 [9fans] IOHDRSZ erik quanstrom
@ 2013-04-04 20:14 ` Charles Forsyth
  2013-04-04 20:49   ` erik quanstrom
  0 siblings, 1 reply; 3+ messages in thread
From: Charles Forsyth @ 2013-04-04 20:14 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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

On 4 April 2013 20:50, erik quanstrom <quanstro@quanstro.net> wrote:

> so
> i think this assumption is going to lead to
> 6-byte buffer overruns.
>

I don't follow the reasoning. bufsize + Rread or Twrite will always fit.
bufsize is the limit for application data. The receiving 9P also trims the
count
to match the receiving buffer.

[-- Attachment #2: Type: text/html, Size: 772 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] IOHDRSZ
  2013-04-04 20:14 ` Charles Forsyth
@ 2013-04-04 20:49   ` erik quanstrom
  0 siblings, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2013-04-04 20:49 UTC (permalink / raw)
  To: 9fans

> On 4 April 2013 20:50, erik quanstrom <quanstro@quanstro.net> wrote:
>
> > so
> > i think this assumption is going to lead to
> > 6-byte buffer overruns.
> >
>
> I don't follow the reasoning. bufsize + Rread or Twrite will always fit.
> bufsize is the limit for application data. The receiving 9P also trims the
> count
> to match the receiving buffer.

i'm thinking of applications that have a seperate buffer for data.
in this case, i can't think of a clean way of sizing that seperate buffer
correctly.  if msize=bufsize+IOHDRSZ, then incoming bytes would
be too big.

- erik



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-04 20:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 19:50 [9fans] IOHDRSZ erik quanstrom
2013-04-04 20:14 ` Charles Forsyth
2013-04-04 20:49   ` erik quanstrom

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