tech-security archive

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

Re: strscpy



On 18.05.2020 19:53, Robert Elz wrote:
> Unfortunately, that function overloads the return value with the
> error indicator, which means it has to be ssize_t rather than size_t,
> which means that half the strings that it is able to copy can't be
> handled because there's no way to return the result properly.
>
> And yes, I know, the chances of anyone ever wanting to copy a string
> that is longer than what can be represented in a ssize_t are slim,
> but given that someone is going to the trouble to design a new
> interface, they really should avoid stupid design limitations.
>

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

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


Home | Main Index | Thread Index | Old Index