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

  • From: jerome.duval@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 29 Oct 2016 22:40:22 +0200 (CEST)

hrev50628 adds 1 changeset to branch 'master'
old head: afbfc7e505f6f894059e45e3adb21e6f86fd0681
new head: 58fb6344aedb69530ce6568c0d4c38f0d19b0f49
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=58fb6344aedb+%5Eafbfc7e505f6

----------------------------------------------------------------------------

58fb6344aedb: libroot: getlogin_r(): 32 is a valid length.
  
  * also use LOGIN_NAME_MAX for the max length.

                                   [ Jérôme Duval <jerome.duval@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50628
Commit:      58fb6344aedb69530ce6568c0d4c38f0d19b0f49
URL:         http://cgit.haiku-os.org/haiku/commit/?id=58fb6344aedb
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Sat Oct 29 20:34:41 2016 UTC

----------------------------------------------------------------------------

1 file changed, 2 insertions(+), 2 deletions(-)
src/system/libroot/posix/unistd/getlogin.c | 4 ++--

----------------------------------------------------------------------------

diff --git a/src/system/libroot/posix/unistd/getlogin.c 
b/src/system/libroot/posix/unistd/getlogin.c
index 61f59a3..9d809de 100644
--- a/src/system/libroot/posix/unistd/getlogin.c
+++ b/src/system/libroot/posix/unistd/getlogin.c
@@ -30,9 +30,9 @@ int getlogin_r(char *name, size_t nameSize)
 {
        struct passwd *pw;
        pw = getpwuid(getuid());
-       if (pw && (nameSize > 32/*PW_MAX_NAME*/)) {
+       if (pw && (nameSize >= LOGIN_NAME_MAX)) {
                memset(name, 0, nameSize);
-               strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/);
+               strlcpy(name, pw->pw_name, LOGIN_NAME_MAX);
                return B_OK;
        }
        return ENOMEM;


Other related posts: