Skip to contentSkip to conversation

rpc-gssd.service has status failed (due to rpc.gssd segfault).

PATCH In review Steve Dickson 1 participant 2 messages Jul 22, 2024 – Jul 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpc-gssd.service has status failed (due to rpc.gssd segfault).

From: Paulo Andrade <[email protected]>

Ensure strings are not NULL before doing a strdup() in error path.

---
 utils/gssd/gssd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
utils/gssd/gssd.c +4 -4
index d7a28225..01ce7d18 100644
@@ -365,12 +365,12 @@ gssd_read_service_info(int dirfd, struct clnt_info *clp)
 
 fail:
 	printerr(0, "ERROR: failed to parse %s/info\n", clp->relpath);
-	clp->upcall_address = strdup(address);
-	clp->upcall_port = strdup(port);
+	clp->upcall_address = address ? strdup(address) : NULL;
+	clp->upcall_port = port ? strdup(port) : NULL;
 	clp->upcall_program = program;
 	clp->upcall_vers = version;
-	clp->upcall_protoname = strdup(protoname);
-	clp->upcall_service = strdup(service);
+	clp->upcall_protoname = protoname ? strdup(protoname) : NULL;
+	clp->upcall_service = service ? strdup(service) : NULL;
 	free(servername);
 	free(protoname);
 	clp->servicename = NULL;
Signature · 1 line
2.45.2
#1 lore raw
Quoted 6 lines · Steve Dickson

From: Paulo Andrade <[email protected]>

Ensure strings are not NULL before doing a strdup() in error path.

Committed...

steved.

Quoted 25 lines
---
  utils/gssd/gssd.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
utils/gssd/gssd.c +4 -4
index d7a28225..01ce7d18 100644
@@ -365,12 +365,12 @@ gssd_read_service_info(int dirfd, struct clnt_info *clp)
 
  fail:
  	printerr(0, "ERROR: failed to parse %s/info\n", clp->relpath);
-	clp->upcall_address = strdup(address);
-	clp->upcall_port = strdup(port);
+	clp->upcall_address = address ? strdup(address) : NULL;
+	clp->upcall_port = port ? strdup(port) : NULL;
  	clp->upcall_program = program;
  	clp->upcall_vers = version;
-	clp->upcall_protoname = strdup(protoname);
-	clp->upcall_service = strdup(service);
+	clp->upcall_protoname = protoname ? strdup(protoname) : NULL;
+	clp->upcall_service = service ? strdup(service) : NULL;
  	free(servername);
  	free(protoname);
  	clp->servicename = NULL;