From ee96c50d4bac709f02f7007ecf669952d56f1b2d Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 19 Jun 2012 22:31:19 -0400 Subject: [PATCH] fix mistake in length test in getlogin_r this was actually dangerously wrong, but presumably nobody uses this broken function anymore anyway.. --- src/unistd/getlogin_r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unistd/getlogin_r.c b/src/unistd/getlogin_r.c index f04f71e5..37ce0d43 100644 --- a/src/unistd/getlogin_r.c +++ b/src/unistd/getlogin_r.c @@ -7,7 +7,7 @@ int getlogin_r(char *name, size_t size) { char *logname = getlogin(); if (!logname) return ENXIO; /* or...? */ - if (strlen(name) >= size) return ERANGE; + if (strlen(logname) >= size) return ERANGE; strcpy(name, logname); return 0; } -- 2.25.1