/*
- * "$Id: network.c 7861 2008-08-26 03:15:14Z mike $"
+ * "$Id$"
*
* Network interface functions for the CUPS scheduler.
*
- * Copyright 2007-2010 by Apple Inc.
+ * Copyright 2007-2012 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
*/
if (httpAddrLocalhost((http_addr_t *)(addr->ifa_addr)))
- strcpy(hostname, "localhost");
+ strlcpy(hostname, "localhost", sizeof(hostname));
else
httpAddrString((http_addr_t *)(addr->ifa_addr), hostname,
sizeof(hostname));
strlcpy(temp->name, addr->ifa_name, sizeof(temp->name));
temp->hostlen = hostlen;
- strcpy(temp->hostname, hostname); /* Safe because hostname is allocated */
+ memcpy(temp->hostname, hostname, hostlen + 1);
if (addr->ifa_addr->sa_family == AF_INET)
{
if (match)
{
- if (lis->address.addr.sa_family == AF_INET)
- temp->port = ntohs(lis->address.ipv4.sin_port);
-#ifdef AF_INET6
- else if (lis->address.addr.sa_family == AF_INET6)
- temp->port = ntohs(lis->address.ipv6.sin6_port);
-#endif /* AF_INET6 */
+ temp->port = httpAddrPort(&(lis->address));
break;
}
}
/*
- * End of "$Id: network.c 7861 2008-08-26 03:15:14Z mike $".
+ * End of "$Id$".
*/