You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/09/09 19:11:17 UTC
svn commit: r995498 - /subversion/trunk/subversion/libsvn_subr/svn_string.c
Author: stsp
Date: Thu Sep 9 17:11:17 2010
New Revision: 995498
URL: http://svn.apache.org/viewvc?rev=995498&view=rev
Log:
* subversion/libsvn_subr/svn_string.c
(svn_cstring_strtoi64, svn_cstring_strtoui64): If apr_strtoi64() reports
the first character of the string as invalid, there is no number in the
string, so return an error. apr_strtoi64() sets errno only to indicate
overflow, not other error conditions, so this additional check is needed.
Modified:
subversion/trunk/subversion/libsvn_subr/svn_string.c
Modified: subversion/trunk/subversion/libsvn_subr/svn_string.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/svn_string.c?rev=995498&r1=995497&r2=995498&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/svn_string.c (original)
+++ subversion/trunk/subversion/libsvn_subr/svn_string.c Thu Sep 9 17:11:17 2010
@@ -616,14 +616,15 @@ svn_cstring_strtoui64(apr_uint64_t *n, c
int base)
{
apr_int64_t parsed;
+ char *endptr;
/* We assume errno is thread-safe. */
errno = 0; /* APR-0.9 doesn't always set errno */
/* ### We're throwing away half the number range here.
* ### Maybe implement our own number parser? */
- parsed = apr_strtoi64(str, NULL, base);
- if (errno != 0)
+ parsed = apr_strtoi64(str, &endptr, base);
+ if (errno != 0 || endptr == str)
return svn_error_return(
svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
_("Could not convert '%s' into a number"),
@@ -659,12 +660,13 @@ svn_cstring_strtoi64(apr_int64_t *n, con
int base)
{
apr_int64_t parsed;
+ char *endptr;
/* We assume errno is thread-safe. */
errno = 0; /* APR-0.9 doesn't always set errno */
- parsed = apr_strtoi64(str, NULL, base);
- if (errno != 0)
+ parsed = apr_strtoi64(str, &endptr, base);
+ if (errno != 0 || endptr == str)
return svn_error_return(
svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
_("Could not convert '%s' into a number"),