[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1034232 - in /subversion/trunk/subversion: include/svn_error_codes.h libsvn_client/changelist.c svn/changelist-cmd.c

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: Thu, 11 Nov 2010 22:28:37 -0600

On Thu, Nov 11, 2010 at 7:26 PM, <danielsh_at_apache.org> wrote:
> Author: danielsh
> Date: Fri Nov 12 01:26:42 2010
> New Revision: 1034232
>
> URL: http://svn.apache.org/viewvc?rev=1034232&view=rev
> Log:
> Add an input validation to the library to prevent assertions on invalid inputs.

Nice! Perhaps mention which inputs are being validated (in this case
changelist names) in the log message?

>
> * subversion/svn/changelist-cmd.c
>  (svn_cl__changelist): Remove input validation here.
>
> * subversion/libsvn_client/changelist.c
>  (svn_client_add_to_changelist): Add it here.
>
> * subversion/include/svn_error_codes.h
>  (SVN_ERR_BAD_CHANGELIST_NAME): New error code.
>
> Modified:
>    subversion/trunk/subversion/include/svn_error_codes.h
>    subversion/trunk/subversion/libsvn_client/changelist.c
>    subversion/trunk/subversion/svn/changelist-cmd.c
>
> Modified: subversion/trunk/subversion/include/svn_error_codes.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error_codes.h?rev=1034232&r1=1034231&r2=1034232&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_error_codes.h (original)
> +++ subversion/trunk/subversion/include/svn_error_codes.h Fri Nov 12 01:26:42 2010
> @@ -219,6 +219,11 @@ SVN_ERROR_START
>              SVN_ERR_BAD_CATEGORY_START + 13,
>              "Unknown string value of token")
>
> +  /** @since New in 1.7. */
> +  SVN_ERRDEF(SVN_ERR_BAD_CHANGELIST_NAME,
> +             SVN_ERR_BAD_CATEGORY_START + 14,
> +             "Invalid changelist name")
> +
>   /* xml errors */
>
>   SVN_ERRDEF(SVN_ERR_XML_ATTRIB_NOT_FOUND,
>
> Modified: subversion/trunk/subversion/libsvn_client/changelist.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/changelist.c?rev=1034232&r1=1034231&r2=1034232&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/changelist.c (original)
> +++ subversion/trunk/subversion/libsvn_client/changelist.c Fri Nov 12 01:26:42 2010
> @@ -107,6 +107,10 @@ svn_client_add_to_changelist(const apr_a
>   apr_hash_t *changelist_hash = NULL;
>   int i;
>
> +  if (changelist[0] == '\0')
> +    return svn_error_create(SVN_ERR_BAD_CHANGELIST_NAME, NULL,
> +                            _("Target changelist name must not be empty"));
> +
>   for (i = 0; i < paths->nelts; i++)
>     {
>       const char *path = APR_ARRAY_IDX(paths, i, const char *);
>
> Modified: subversion/trunk/subversion/svn/changelist-cmd.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/changelist-cmd.c?rev=1034232&r1=1034231&r2=1034232&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svn/changelist-cmd.c (original)
> +++ subversion/trunk/subversion/svn/changelist-cmd.c Fri Nov 12 01:26:42 2010
> @@ -55,9 +55,6 @@ svn_cl__changelist(apr_getopt_t *os,
>       apr_array_header_t *args;
>       SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool));
>       changelist_name = APR_ARRAY_IDX(args, 0, const char *);
> -      if (changelist_name[0] == '\0')
> -        return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
> -                                _("Changelist names must not be empty"));
>       SVN_ERR(svn_utf_cstring_to_utf8(&changelist_name,
>                                       changelist_name, pool));
>     }
>
>
>
Received on 2010-11-12 05:29:19 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.