From 5cce838a2454927c3fea8ad6defadf1f2ce4833f Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 21 Jul 2009 11:04:41 -0700 Subject: [PATCH] Fix warnings in vlserver/vlprocs.c rxinfo's code to print out the principal corresponding to an rx_call uses static arrays for the principal components but was checking that the array pointer was non-NULL when deciding whether to print principal components. Instead check whether each portion of the principal is the empty string. Add explicit initializations of the static buffers to the empty string so that we're not relying on rxkad_GetServerInfo always initializing them for us. Reviewed-on: http://gerrit.openafs.org/http://gerrit.openafs.org/163 Reviewed-by: Simon Wilkinson Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/vlserver/vlprocs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vlserver/vlprocs.c b/src/vlserver/vlprocs.c index 5a5dc1b..73f5658 100644 --- a/src/vlserver/vlprocs.c +++ b/src/vlserver/vlprocs.c @@ -95,9 +95,9 @@ rxinfo(struct rx_call *rxcall) { int code; register struct rx_connection *tconn; - char tname[64]; - char tinst[64]; - char tcell[64]; + char tname[64] = ""; + char tinst[64] = ""; + char tcell[64] = ""; afs_uint32 exp; struct in_addr hostAddr; @@ -108,7 +108,10 @@ rxinfo(struct rx_call *rxcall) NULL); if (!code) sprintf(rxinfo_str, "%s %s%s%s%s%s", inet_ntoa(hostAddr), tname, - tinst?".":"", tinst?tinst:"", tcell?"@":"", tcell?tcell:""); + (tinst[0] == '\0') ? "" : ".", + (tinst[0] == '\0') ? "" : tinst, + (tcell[0] == '\0') ? "" : "@", + (tcell[0] == '\0') ? "" : tcell); else sprintf(rxinfo_str, "%s noauth", inet_ntoa(hostAddr)); return (rxinfo_str); -- 1.9.4