aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Mingrone <jrm@FreeBSD.org>2023-01-09 21:27:58 +0000
committerJoseph Mingrone <jrm@FreeBSD.org>2023-01-09 22:35:17 +0000
commit3b715073072794942506d27d72b2b23551c4fd30 (patch)
treed40d2995ee0dcb2b2731b9e71e9884a7ecbb527d
parent5d0279df7adb058f40d0dc6024b88376dfab8aa5 (diff)
downloadports-3b715073072794942506d27d72b2b23551c4fd30.tar.gz
ports-3b715073072794942506d27d72b2b23551c4fd30.zip
devel/arcanist-lib: Handle NULL argument passed to strlen()
Problem description: - ArcanistDiffWorkflow.php:getDiffOntoTargets() tries to determine the current branch name by calling ArcanistGitAPI.php:getBranchName() - getBranchName() returns NULL when working on a detached HEAD - getDiffOntoTargets() calls strlen() with the branch name, which now fails with a NULL argument. Approved by: grembo (maintainer) Sponsored by: The FreeBSD Foundation
-rw-r--r--devel/arcanist-lib/Makefile2
-rw-r--r--devel/arcanist-lib/files/patch-src_workflow_ArcanistDiffWorkflow.php11
2 files changed, 12 insertions, 1 deletions
diff --git a/devel/arcanist-lib/Makefile b/devel/arcanist-lib/Makefile
index 8fbe5718f993..88851111a747 100644
--- a/devel/arcanist-lib/Makefile
+++ b/devel/arcanist-lib/Makefile
@@ -1,6 +1,6 @@
PORTNAME?= arcanist
PORTVERSION?= 20220518
-PORTREVISION?= 2
+PORTREVISION?= 3
CATEGORIES?= devel
PKGNAMESUFFIX= ${SLAVE_PKGNAMESUFFIX}${PHP_PKGNAMESUFFIX}
diff --git a/devel/arcanist-lib/files/patch-src_workflow_ArcanistDiffWorkflow.php b/devel/arcanist-lib/files/patch-src_workflow_ArcanistDiffWorkflow.php
new file mode 100644
index 000000000000..f132ed21d524
--- /dev/null
+++ b/devel/arcanist-lib/files/patch-src_workflow_ArcanistDiffWorkflow.php
@@ -0,0 +1,11 @@
+--- src/workflow/ArcanistDiffWorkflow.php.orig 2023-01-09 21:24:25 UTC
++++ src/workflow/ArcanistDiffWorkflow.php
+@@ -2361,7 +2361,7 @@ EOTEXT
+
+ // If we track an upstream branch either directly or indirectly, use that.
+ $branch = $api->getBranchName();
+- if (strlen($branch)) {
++ if (strlen($branch ?? '')) {
+ $upstream_path = $api->getPathToUpstream($branch);
+ $remote_branch = $upstream_path->getRemoteBranchName();
+ if ($remote_branch !== null) {