tech-security archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strscpy



    Date:        Mon, 18 May 2020 20:24:06 +0200
    From:        Kamil Rytarowski <n54%gmx.com@localhost>
    Message-ID:  <0fb06a8c-959b-4f8e-58ca-b94bac1fc036%gmx.com@localhost>

  | This is a design of several standard UNIX APIs (write(2),read(2) etc).

I know, but those were invented back when the (relevant) arg/result were
int - before there were any _t's at all, and when the likelihood of any
application ever doing I/O of 2^32 bytes or more was slim, and where it
was possible, it was also safe to test the result against -1, and when
it was not that, simply treat it as unsigned.

Ideally we'd fix those old interfaces, but practically that's never going
to happen.

But for new interface design, there is no excuse for getting this kind of
thing wrong.

  | Even if we want to use larger values in some APIs and they are in theory
  | allowed, we get EFBIG that is the system-wide maximum (2**63).

On NetBSD as it exists currently, sure - but this is supposed to be a
portable API, that can be used anywhere - if we had a pdp-11 port, it
would still use 16 bit size_t and 15 bit ssize_t (off_t would be much
larger, but that's irrelevant).

kre



Home | Main Index | Thread Index | Old Index