Commit ca53cc8e authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(login_request): Don't use snprintf. It's not portable.

parent 7509e4ad
/*
* $Id: connections.c,v 0.77 2002/08/20 07:13:06 ceder Exp $
* $Id: connections.c,v 0.78 2002/08/23 07:03:36 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -672,7 +672,9 @@ login_request(IscEvent *event)
const char *realuser;
char *hostname = NULL;
char peername[256];
size_t len;
char portbuf[1+2+3*sizeof(long)];
size_t hostlen;
size_t portlen;
/* Supress logins if /etc/nologin exists */
if (fexists(param.nologin_file))
......@@ -719,18 +721,18 @@ login_request(IscEvent *event)
BUG(("\n[Client %lu from %s is connecting]\n", cp->session_no, hostname));
isc_getipnum(event->session->info.tcp.raddr, peername, sizeof(peername)-1);
len = strlen(peername);
snprintf(peername + len, sizeof(peername) - len, " %d",
isc_getportnum(event->session->info.tcp.raddr));
len = strlen(peername) + 1;
if (len >= sizeof(peername))
isc_getipnum(event->session->info.tcp.raddr, peername, sizeof(peername));
hostlen = strlen(peername);
if (hostlen >= sizeof(peername)-1)
{
kom_log("login_request(): truncated remote peer address %s.\n",
peername);
}
cp->peer = smalloc(len);
sprintf(portbuf, " %d", isc_getportnum(event->session->info.tcp.raddr));
portlen = strlen(portbuf);
cp->peer = smalloc(hostlen + portlen + 1);
strcpy(cp->peer, peername);
strcpy(cp->peer + hostlen, portbuf);
dump_connections();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment