php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63230 svn_info() crashes with Zero-length error string
Submitted: 2012-10-06 14:40 UTC Modified: 2012-10-06 16:08 UTC
From: tsamu911 at gmai dot com Assigned: felipe (profile)
Status: Closed Package: svn (PECL)
PHP Version: Irrelevant OS: CentOS 6.3
Private report: No CVE-ID: None
 [2012-10-06 14:40 UTC] tsamu911 at gmai dot com
Description:
------------
Some svnserve server returns Zero-length error message like this.
  "( failure ( ( 170001 0: 56:C:\Projects\subversion-
1.4.4\subversion\svnserve\serve.c 443 ) ) )"
In that case, svn_info() function causes Segmentation fault. 

I modified source file "svn.c" to avoid this problem;
  
---- php_svn_handle_error() in svn.c ---
266  smart_str_appendl(&s, ") ", 2);
267  smart_str_appendl(&s, itr->message, strlen(itr->message));
268                 
----
---- modified code ---
266  smart_str_appendl(&s, ") ", 2);
267  if (itr->message) {
268    smart_str_appendl(&s, itr->message, strlen(itr->message));
269  } else {
270    smart_str_appendl(&s, "(null)", 6);
271  }


Test script:
---------------
$url = "svn://(svnserve server)/";
$username = "(username)";
$password = "(password)";
svn_auth_set_parameter(PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS, true);
svn_auth_set_parameter(SVN_AUTH_PARAM_NON_INTERACTIVE,              true);
svn_auth_set_parameter(SVN_AUTH_PARAM_NO_AUTH_CACHE,                true);
svn_auth_set_parameter(SVN_AUTH_PARAM_DONT_STORE_PASSWORDS,         true);

svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, "$username");
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, "$password");

$svn_info = svn_info($url, false, SVN_REVISION_HEAD);
var_dump($svn_info);


Expected result:
----------------
Warning is reported like this;
Warning: svn_info(): svn error(s) occured
170001 (Authorization failed) (Could not get message)


Actual result:
--------------
Segmentation fault


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-06 14:50 UTC] tsamu911 at gmai dot com
-PHP Version: 5.4.7 +PHP Version: Irrelevant
 [2012-10-06 14:50 UTC] tsamu911 at gmai dot com
Php version is Irrelevant. svn-php version = 1.0.2, client svn version=1.6.11
 [2012-10-06 16:08 UTC] felipe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
 [2012-10-06 16:08 UTC] felipe@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 03:01:29 2024 UTC