summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-29 11:13:32 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-23 12:15:06 -0800
commit3d2d88029b29d6e1c53220ad275ba8ba2dedd89e (patch)
tree5a6a47c82dc1d5db1db22a5ccb681083dfb67a3d /os
parent615f93a3d03d40924365061c6ae242240dd0ab7e (diff)
AuthAudit: clean up string handling calls
The extra "out" pointer to redirect writes to the array isn't needed since the removal of LBX (commit a9ed5a87902a), and eliminating it allows more logical use of sizeof(addr) in length-checked strlcpy & snprintf calls to write to it. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'os')
-rw-r--r--os/connection.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/os/connection.c b/os/connection.c
index b339f4e96..957b928dd 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -499,7 +499,6 @@ AuthAudit (ClientPtr client, Bool letin,
unsigned int proto_n, char *auth_proto, int auth_id)
{
char addr[128];
- char *out = addr;
char client_uid_string[64];
LocalClientCredRec *lcc;
#ifdef XSERVER_DTRACE
@@ -508,7 +507,7 @@ AuthAudit (ClientPtr client, Bool letin,
#endif
if (!len)
- strcpy(out, "local host");
+ strlcpy(addr, "local host", sizeof(addr));
else
switch (saddr->sa_family)
{
@@ -516,11 +515,11 @@ AuthAudit (ClientPtr client, Bool letin,
#if defined(UNIXCONN) || defined(LOCALCONN)
case AF_UNIX:
#endif
- strcpy(out, "local host");
+ strlcpy(addr, "local host", sizeof(addr));
break;
#if defined(TCPCONN) || defined(STREAMSCONN)
case AF_INET:
- sprintf(out, "IP %s",
+ snprintf(addr, sizeof(addr), "IP %s",
inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr));
break;
#if defined(IPv6) && defined(AF_INET6)
@@ -528,13 +527,13 @@ AuthAudit (ClientPtr client, Bool letin,
char ipaddr[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, &((struct sockaddr_in6 *) saddr)->sin6_addr,
ipaddr, sizeof(ipaddr));
- sprintf(out, "IP %s", ipaddr);
+ snprintf(addr, sizeof(addr), "IP %s", ipaddr);
}
break;
#endif
#endif
default:
- strcpy(out, "unknown address");
+ strlcpy(addr, "unknown address", sizeof(addr));
}
if (GetLocalClientCreds(client, &lcc) != -1) {