select: fix 64-bit timeout truncation on pre-time64 kernels
[musl] / src / legacy / getpass.c
index 15ab985..d51286c 100644 (file)
@@ -27,7 +27,7 @@ char *getpass(const char *prompt)
 
        l = read(fd, password, sizeof password);
        if (l >= 0) {
-               if (l > 0 && password[l-1] == '\n') l--;
+               if (l > 0 && password[l-1] == '\n' || l==sizeof password) l--;
                password[l] = 0;
        }