Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 63615 invoked by uid 500); 11 Feb 2001 23:35:07 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 63601 invoked by uid 1134); 11 Feb 2001 23:35:07 -0000 Date: 11 Feb 2001 23:35:07 -0000 Message-ID: <20010211233507.63600.qmail@apache.org> From: wrowe@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/passwd apr_getpass.c wrowe 01/02/11 15:35:07 Modified: passwd apr_getpass.c Log: Still wasn't right. Always return the (partial/complete) password string, and use the apr_status_t as the -one and only- indicatator of success, partial success or failure. Revision Changes Path 1.13 +3 -5 apr/passwd/apr_getpass.c Index: apr_getpass.c =================================================================== RCS file: /home/cvs/apr/passwd/apr_getpass.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- apr_getpass.c 2001/02/11 23:32:11 1.12 +++ apr_getpass.c 2001/02/11 23:35:07 1.13 @@ -215,12 +215,10 @@ APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf, size_t *bufsiz) { char *pw_got = getpass(prompt); - if (strlen(pw_got) > (*bufsiz - 1)) { - *bufsiz = ERR_OVERFLOW; - memset(pw_got, 0, strlen(pw_got)); - return APR_ENAMETOOLONG; - } apr_cpystrn(pwbuf, pw_got, *bufsiz); memset(pw_got, 0, strlen(pw_got)); + if (strlen(pw_got) >= *bufsiz) { + return APR_ENAMETOOLONG; + } return APR_SUCCESS; }