[PATCH,HURD] hurd: compliance fixes for getlogin_r

Pino Toscano toscano.pino@tiscali.it
Sat Apr 28 12:03:00 GMT 2012


Alle sabato 28 aprile 2012, Roland McGrath ha scritto:
> You can just use string_t and no need for the XXX comment.

Fixed. (I initially made my changes as less intrusive as possible.)

> libc code can use C99 freely these days, so use an inline
> initializing declaration rather than pre-declaring a new variable.

Hm ok; is it bad if I leave them as it is, for now?

> I don't think there's any need to iniitalize the result buffer.  We
> trust the RPC stubs to return a properly-terminated string on
> success, and if they didn't then that wouldn't necessarily catch it
> anyway.  If you want that sort of paranoia, use __strnlen (login,
> sizeof login - 1).
> 
> If you've already called strlen/strnlen then don't use strncpy,
> just use memcpy with the known length.

Fixed.

Attached there is the updated patch.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hurd_getlogin_r.diff
Type: text/x-patch
Size: 1021 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120428/998ad4e3/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120428/998ad4e3/attachment.sig>


More information about the Libc-alpha mailing list