X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Flocate_host.c;h=8b03833d5e3a97afe148b7ada2faaead331b0e6f;hb=5a825607ef9581165e382ab6989c1c4d7cdf1254;hp=7b5869907c8cb3cdb9c54e13295b3a5689c43ff4;hpb=f0e6b0183e4739e5fe35fbc8bd116c7b219c0ab7;p=citadel.git diff --git a/webcit/locate_host.c b/webcit/locate_host.c index 7b5869907..8b03833d5 100644 --- a/webcit/locate_host.c +++ b/webcit/locate_host.c @@ -15,7 +15,7 @@ * \param tbuf the returnbuffer * \param client_socket the sock fd where the client is connected */ -void locate_host(char *tbuf, int client_socket) +void locate_host(StrBuf *tbuf, int client_socket) { struct sockaddr_in cs; struct hostent *ch; @@ -25,7 +25,7 @@ void locate_host(char *tbuf, int client_socket) len = sizeof(cs); if (getpeername(client_socket, (struct sockaddr *) &cs, &len) < 0) { - strcpy(tbuf, ""); + StrBufAppendBufPlain(tbuf, HKEY(""), 0); return; } if ((ch = gethostbyaddr((char *) &cs.sin_addr, sizeof(cs.sin_addr), @@ -35,10 +35,10 @@ void locate_host(char *tbuf, int client_socket) a2 = ((*i++) & 0xff); a3 = ((*i++) & 0xff); a4 = ((*i++) & 0xff); - sprintf(tbuf, "%d.%d.%d.%d", a1, a2, a3, a4); + StrBufPrintf(tbuf, "%d.%d.%d.%d", a1, a2, a3, a4); return; } - safestrncpy(tbuf, ch->h_name, 64); + StrBufAppendBufPlain(tbuf, ch->h_name, -1, 0); } /*@}*/