"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Renato Aguiar <renato@renatoaguiar.net>
Subject:
Fix got-read-gotconfig SIGSEGV when using "send" config block
To:
gameoftrees@openbsd.org
Date:
Thu, 26 Jun 2025 20:50:37 -0700

Download raw body.

Thread
Hi,

I got the following error when trying to run "got fetch" with a "send"
block in got.conf:

    "got: unprivileged process died unexpectedly"

Digged down a bit and found out that got-read-gotconfig is being
terminated with SIGSEGV while trying to free a NULL pointer. That is
caused by "free_send_config" function referencing the global variable
"remote" instead of the its own argument.

This patch fixes "free_send_config" and also "free_fetch_config", which
has the exact same problem.

diff /home/renato/src/got
path + /home/renato/src/got
commit - 1d26dbd4b176e993c088a1b058223d613ef9365c
blob - cf5be7e73168496c2b26cde6b459a1167864c846
file + libexec/got-read-gotconfig/parse.y
--- libexec/got-read-gotconfig/parse.y
+++ libexec/got-read-gotconfig/parse.y
@@ -791,19 +791,19 @@ gotconfig_parse(struct gotconfig **conf, const char *f
 static void
 free_fetch_config(struct fetch_config *fetch_config)
 {
-	free(remote->fetch_config->repository);
-	free(remote->fetch_config->server);
-	free(remote->fetch_config->protocol);
-	free(remote->fetch_config);
+	free(fetch_config->repository);
+	free(fetch_config->server);
+	free(fetch_config->protocol);
+	free(fetch_config);
 }
 
 static void
 free_send_config(struct send_config *send_config)
 {
-	free(remote->send_config->repository);
-	free(remote->send_config->server);
-	free(remote->send_config->protocol);
-	free(remote->send_config);
+	free(send_config->repository);
+	free(send_config->server);
+	free(send_config->protocol);
+	free(send_config);
 }
 
 void