~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_subr/types.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include "svn_props.h"
32
32
#include "svn_private_config.h"
33
33
 
 
34
#include "private/svn_dep_compat.h"
 
35
#include "private/svn_string_private.h"
 
36
 
34
37
svn_error_t *
35
38
svn_revnum_parse(svn_revnum_t *rev,
36
39
                 const char *str,
37
40
                 const char **endptr)
38
41
{
39
 
  char *end;
40
 
 
41
 
  svn_revnum_t result = strtol(str, &end, 10);
 
42
  const char *end;
 
43
 
 
44
  svn_revnum_t result = (svn_revnum_t)svn__strtoul(str, &end);
 
45
 
 
46
  if (endptr)
 
47
    *endptr = str;
 
48
 
 
49
  if (str == end)
 
50
    return svn_error_createf
 
51
              (SVN_ERR_REVNUM_PARSE_FAILURE, NULL,
 
52
               *str == '-' ? _("Negative revision number found parsing '%s'")
 
53
                           : _("Invalid revision number found parsing '%s'"),
 
54
               str);
 
55
 
 
56
  /* a revision number with more than 9 digits is suspicious.
 
57
     Have a closer look at those. */
 
58
  if (str + 10 <= end)
 
59
    {
 
60
      /* we support 32 bit revision numbers only. check for overflows */
 
61
      if (str + 10 < end)
 
62
        return svn_error_createf
 
63
                  (SVN_ERR_REVNUM_PARSE_FAILURE, NULL,
 
64
                  _("Revision number longer than 10 digits '%s'"), str);
 
65
 
 
66
      /* we support 32 bit revision numbers only. check for overflows */
 
67
      if (*str > '2' || (apr_uint32_t)result > APR_INT32_MAX)
 
68
        return svn_error_createf
 
69
                  (SVN_ERR_REVNUM_PARSE_FAILURE, NULL,
 
70
                  _("Revision number too large '%s'"), str);
 
71
    }
42
72
 
43
73
  if (endptr)
44
74
    *endptr = end;
45
75
 
46
 
  if (str == end)
47
 
    return svn_error_createf(SVN_ERR_REVNUM_PARSE_FAILURE, NULL,
48
 
                             _("Invalid revision number found parsing '%s'"),
49
 
                             str);
50
 
 
51
 
  if (result < 0)
52
 
    {
53
 
      /* The end pointer from strtol() is valid, but a negative revision
54
 
         number is invalid, so move the end pointer back to the
55
 
         beginning of the string. */
56
 
      if (endptr)
57
 
        *endptr = str;
58
 
 
59
 
      return svn_error_createf(SVN_ERR_REVNUM_PARSE_FAILURE, NULL,
60
 
                               _("Negative revision number found parsing '%s'"),
61
 
                               str);
62
 
    }
63
 
 
64
76
  *rev = result;
65
77
 
66
78
  return SVN_NO_ERROR;