Blair Zajac wrote on Tue, Jul 17, 2012 at 09:48:25 -0700:
> On 7/17/12 6:17 AM, phi...@apache.org wrote:
> >Author: philip
> >Date: Tue Jul 17 13:17:34 2012
> >New Revision: 1362480
> >
> >URL: http://svn.apache.org/viewvc?rev=1362480&view=rev
> >Log:
> >* subversion/libsvn_fs/fs-loader.c
> >   (load_module): Only allow alphanumeric characters in name.
> >
> 
> >      apr_status_t status;
> >+    apr_size_t i;
> >+
> >+    /* Demand a simple alphanumeric name so that the generated DSO
> >+       name is sensible. */
> >+    for (i = 0; i < strlen(name); ++i)
> >+      if (!svn_ctype_isalnum(name[i]))
> >+        return svn_error_createf(SVN_ERR_FS_UNKNOWN_FS_TYPE, NULL,
> >+                                 _("Invalid name for FS type '%s'"),
> >+                                 name);
> 
> This code doesn't probably get run often, but generally it's better
> to iterate through name using pointers instead of strlen() since the
> later scans the string twice.
> 

Once per iteration of the loop...

(Yes, you both know this, but http://xkcd.com/386/) 

> Blair
> 
> 

Reply via email to