Fix more sprintf calls.

This commit is contained in:
Marc Balmer
2012-08-09 07:38:39 +02:00
committed by Jon Trulson
parent 24c0f2010c
commit 1d935059fb
5 changed files with 22 additions and 20 deletions

View File

@@ -115,7 +115,7 @@ _DtCmGetLocalDomain(char *hostname)
ptr = domain;
if (hostname == NULL) hostname = _DtCmGetLocalHost();
while (1) {
sprintf(buf, "%s.%s", hostname, ptr);
snprintf(buf, sizeof buf, "%s.%s", hostname, ptr);
if ((cl = clnt_create(buf, 100068, 5, "udp")) == NULL) {
ptr = strchr(ptr, '.');
if (ptr)
@@ -145,9 +145,10 @@ _DtCmGetHostAtDomain()
host = _DtCmGetLocalHost();
if (strchr(host, '.') == NULL)
sprintf(hostname, "%s.%s", host,
snprintf(hostname, BUFSIZ, "%s.%s", host,
_DtCmGetLocalDomain(host));
else
/* XXX strcpy unsafe here */
strcpy(hostname, host);
}