diff mbox series

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

Message ID 20240722091638.53546-1-steved@redhat.com (mailing list archive)
State New
Headers show
Series rpc-gssd.service has status failed (due to rpc.gssd segfault). | expand

Commit Message

Steve Dickson July 22, 2024, 9:16 a.m. UTC
From: Paulo Andrade <pandrade@redhat.com>

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

Fixes: https://issues.redhat.com/browse/RHEL-43286
Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/gssd/gssd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Steve Dickson July 23, 2024, 4:09 p.m. UTC | #1
On 7/22/24 5:16 AM, Steve Dickson wrote:
> From: Paulo Andrade <pandrade@redhat.com>
> 
> Ensure strings are not NULL before doing a strdup() in error path.
> 
> Fixes: https://issues.redhat.com/browse/RHEL-43286
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed...

steved.

> ---
>   utils/gssd/gssd.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
> index d7a28225..01ce7d18 100644
> --- a/utils/gssd/gssd.c
> +++ b/utils/gssd/gssd.c
> @@ -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;
diff mbox series

Patch

diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index d7a28225..01ce7d18 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -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;