[haiku-commits] Re: haiku: hrev50628 - src/system/libroot/posix/unistd

  • From: François Revol <revol@xxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 30 Oct 2016 01:15:28 +0200

On 29/10/2016 23:41, Jérôme Duval wrote:

2016-10-29 22:57 GMT+02:00 Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:
Shouldn't that be something like:

        int needed = strlcpy(name, pw->pw_name, nameSize);
        if (needed > nameSize)
                return ENOMEM;
        return B_OK;

?
Why only accept "name" if it's equal or larger than the maximum, and then
only write the maximum to it?

Maybe ask François:
http://cgit.haiku-os.org/haiku/commit/?id=ffb64301bf46d864cb7f798bd4085227107f941a
I think you're right, the return code should be ERANGE though.

What did I do again? I think this crime is prescribed :D

Not, maybe I was too lazy to check if strlcpy included the \0 or not, looks weird though.

François.

Other related posts: