You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Greg Stein <gs...@lyra.org> on 2001/02/12 03:05:14 UTC

Re: cvs commit: apr/include apr_lib.h

On Sun, Feb 11, 2001 at 11:31:04PM -0000, wrowe@apache.org wrote:
> wrowe       01/02/11 15:31:04
> 
>   Modified:    .        CHANGES
>                passwd   apr_getpass.c
>                include  apr_lib.h
>   Log:
>     result(?)  What result?  Stop mauling the size_t arg and overwrite the
>     system buffer before returning from apr_password_get, and clean up doc.
>...
>   --- apr_lib.h	2001/02/11 00:12:11	1.51
>   +++ apr_lib.h	2001/02/11 23:31:04	1.52
>   @@ -220,12 +220,12 @@
>    /**
>     * Display a prompt and read in the password from stdin.
>     * @param prompt The prompt to display
>   - * @param pwbuf Where to store the password
>   - * @param bufsize The length of the password string.
>   + * @param pwbuf Buffer to store the password
>   + * @param bufsize The length of the password buffer.
>     * @deffunc apr_status_t apr_password_get(const char *prompt, char *pwbuf, size_t *bufsize)
>     */
>    APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf, 
>   -                                      size_t *bufsize);
>   +                                           size_t *bufsize);

Um... couldn't that bufsize just be an apr_size_t rather than "size_t *" ??
If you aren't going to return a value, then drop the indirection, right?

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: apr/include apr_lib.h

Posted by Greg Stein <gs...@lyra.org>.
[ bringing back to list; OtherBill apparently misfired the reply ]

On Sun, Feb 11, 2001 at 09:37:31PM -0600, William A. Rowe, Jr. wrote:
> From: "Greg Stein" <gs...@lyra.org>
> Sent: Sunday, February 11, 2001 8:05 PM
> 
> 
> > > wrowe       01/02/11 15:31:04
> > > 
> > >   Modified:    .        CHANGES
> > >                passwd   apr_getpass.c
> > >                include  apr_lib.h
> > >   Log:
> > >     result(?)  What result?  Stop mauling the size_t arg and overwrite the
> > >     system buffer before returning from apr_password_get, and clean up doc.
> 
> > >    APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf, 
> > >   -                                      size_t *bufsize);
> > >   +                                           size_t *bufsize);
> 
> > Um... couldn't that bufsize just be an apr_size_t rather than "size_t *" ??
> > If you aren't going to return a value, then drop the indirection, right?
> 
> Absolutely apr_size_t.  And that is a question, do we want to return the actual
> size needed/used?  I personally don't care, but wasn't going to make that call
> when I was fixing the fn (returned 0 before, rather useless.)  So I'd agree in
> part, either apr_size_t bufsize, or apr_size_t *bufsize returning the size used
> or needed (len as returned by getpass).

I don't think we need to return the size. The caller can always use strlen()
if that is needed.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/