summaryrefslogtreecommitdiffstats
path: root/libexec/uucpd/uucpd.c
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1997-04-01 20:39:59 +0000
committerjoerg <joerg@FreeBSD.org>1997-04-01 20:39:59 +0000
commit4c5376055867dcc7bd19a88b1ea8b1a729cdba95 (patch)
treea7a389dbd37d7afa76d78ba4fb2ca8a749f575f0 /libexec/uucpd/uucpd.c
parent01527101643eb6105933df3b9232518e99aeeaec (diff)
downloadFreeBSD-src-4c5376055867dcc7bd19a88b1ea8b1a729cdba95.zip
FreeBSD-src-4c5376055867dcc7bd19a88b1ea8b1a729cdba95.tar.gz
Use MAXHOSTNAMELEN, as opposed to an arbitrary number, and ensure
correct termination if it overflows. Closes PR # misc/2982. Submitted by: Drew Derbyshire <ahd@kew.com>
Diffstat (limited to 'libexec/uucpd/uucpd.c')
-rw-r--r--libexec/uucpd/uucpd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c
index 06ba9fa..bbbb4b9 100644
--- a/libexec/uucpd/uucpd.c
+++ b/libexec/uucpd/uucpd.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: uucpd.c,v 1.9 1997/02/22 14:22:39 peter Exp $
+ * $Id: uucpd.c,v 1.10 1997/03/25 09:52:38 davidn Exp $
*/
#ifndef lint
@@ -55,6 +55,7 @@ static char sccsid[] = "@(#)uucpd.c 8.1 (Berkeley) 6/4/93";
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
@@ -117,7 +118,7 @@ void main(int argc, char **argv)
void badlogin(char *name, struct sockaddr_in *sin)
{
- char remotehost[32];
+ char remotehost[MAXHOSTNAMELEN];
struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr,
sizeof (struct in_addr), AF_INET);
@@ -128,6 +129,8 @@ void badlogin(char *name, struct sockaddr_in *sin)
strncpy(remotehost, inet_ntoa(sin->sin_addr),
sizeof (remotehost));
+ remotehost[sizeof remotehost - 1] = '\0';
+
syslog(LOG_NOTICE, "LOGIN FAILURE FROM %s", remotehost);
syslog(LOG_AUTHPRIV|LOG_NOTICE,
"LOGIN FAILURE FROM %s, %s", remotehost, name);
@@ -242,7 +245,7 @@ void dologout(void)
void dologin(struct passwd *pw, struct sockaddr_in *sin)
{
char line[32];
- char remotehost[32];
+ char remotehost[MAXHOSTNAMELEN];
int f;
time_t cur_time;
struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr,
OpenPOWER on IntegriCloud