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

Re: Filenames with trailing newlines wreak havoc

From: Ivan Zhakov <ivan_at_visualsvn.com>
Date: Tue, 26 Mar 2013 23:48:53 +0400

On Tue, Mar 26, 2013 at 11:07 PM, Ben Reser <ben_at_reser.org> wrote:
> On Tue, Mar 26, 2013 at 10:57 AM, Ivan Zhakov <ivan_at_visualsvn.com> wrote:
>> We already have svn_fs__path_valid() and validate all incoming FS
>> paths in fs-loader.c. Current svn_fs__path_valid() implementation is:
>> [[[
>> svn_error_t *
>> svn_fs__path_valid(const char *path, apr_pool_t *pool)
>> {
>> /* UTF-8 encoded string without NULs. */
>> if (! svn_utf__cstring_is_valid(path))
>> {
>> return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,
>> _("Path '%s' is not in UTF-8"), path);
>> }
>>
>> /* No "." or ".." elements. */
>> if (svn_path_is_backpath_present(path)
>> || svn_path_is_dotpath_present(path))
>> {
>> return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,
>> _("Path '%s' contains '.' or '..' element"),
>> path);
>> }
>>
>> /* That's good enough. */
>> return SVN_NO_ERROR;
>> }
>> ]]]
>>
>> Can we just extend it to prohibit all characters with ascii code < 31 ?
>
> Iterate the characters and use svn_ctype_iscntrl()
Yes, btw we already have such code in svn_path_check().

-- 
Ivan Zhakov
Received on 2013-03-26 20:49:44 CET

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