Skip to content

Commit 2797063

Browse files
committed
fix segfault due to wrong arg type
1 parent f47a0d7 commit 2797063

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

git2_remote.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static PHP_METHOD(Remote, download) {
201201
HashTable *refspecs = NULL;
202202
HashTable *opts = NULL;
203203

204-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!a!", &refspecs, &opts) != SUCCESS) {
204+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h!h!", &refspecs, &opts) != SUCCESS) {
205205
return;
206206
}
207207

@@ -235,20 +235,20 @@ static PHP_METHOD(Remote, fetch) {
235235
HashTable *refspecs = NULL;
236236
HashTable *opts = NULL;
237237
git_fetch_options git_opts = GIT_FETCH_OPTIONS_INIT;
238+
238239
git_strarray git_refspecs;
239240
git_refspecs.count = 0;
240241

241-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!a!", &refspecs, &opts) != SUCCESS) {
242+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h!h!", &refspecs, &opts) != SUCCESS) {
242243
return;
243244
}
244245

245246
GIT2_REMOTE_FETCH();
246247

247248
// parse parameters
248-
git2_parse_fetch_options(&git_opts, opts);
249-
250249
if (refspecs)
251250
php_git2_ht_to_strarray(&git_refspecs, refspecs);
251+
git2_parse_fetch_options(&git_opts, opts);
252252

253253
int res = git_remote_fetch(intern->remote, &git_refspecs, &git_opts, NULL);
254254

@@ -271,7 +271,7 @@ static PHP_METHOD(Remote, upload) {
271271
HashTable *refspecs = NULL;
272272
HashTable *opts = NULL;
273273

274-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!a!", &refspecs, &opts) != SUCCESS) {
274+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h!h!", &refspecs, &opts) != SUCCESS) {
275275
return;
276276
}
277277
GIT2_REMOTE_FETCH();
@@ -302,7 +302,7 @@ static PHP_METHOD(Remote, push) {
302302
HashTable *refspecs = NULL;
303303
HashTable *opts = NULL;
304304

305-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!a!", &refspecs, &opts) != SUCCESS) {
305+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h!h!", &refspecs, &opts) != SUCCESS) {
306306
return;
307307
}
308308
GIT2_REMOTE_FETCH();

0 commit comments

Comments
 (0)