diff options
| author | mrg <mrg@NetBSD.org> | 1997-01-23 14:01:45 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 1997-01-23 14:01:45 +0000 |
| commit | 9cd5492c0260bc081b84b3657f5d7fd950e2aa9b (patch) | |
| tree | 0980f3cf304e504ae3b29328e52850920b9c01c7 /lib/libwrap/socket.c | |
| parent | dff93f1d733a6cdd1fd4234340e77f5621d5895b (diff) | |
- convert unsafe strcpy(), strcat() and sprintf() to the `n' versions.
- some KNF.
Diffstat (limited to 'lib/libwrap/socket.c')
| -rw-r--r-- | lib/libwrap/socket.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libwrap/socket.c b/lib/libwrap/socket.c index 7033b7e7a96..f96bbbbb39a 100644 --- a/lib/libwrap/socket.c +++ b/lib/libwrap/socket.c @@ -61,7 +61,7 @@ char *name; if (strchr(name, '.') == 0 || strlen(name) >= MAXHOSTNAMELEN - 1) { return (gethostbyname(name)); } else { - sprintf(dot_name, "%s.", name); + (void)snprintf(dot_name, sizeof dot_name, "%s.", name); return (gethostbyname(dot_name)); } } @@ -213,7 +213,8 @@ struct host_info *host; tcpd_warn("host name/address mismatch: %s != %s", inet_ntoa(sin->sin_addr), hp->h_name); } - strcpy(host->name, paranoid); /* name is bad, clobber it */ + /* name is bad, clobber it */ + (void)strncpy(host->name, paranoid, sizeof(host->name) - 1); } } |
