summaryrefslogtreecommitdiff
path: root/usr.sbin/map-mbone
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-03-27 20:17:35 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-03-27 20:17:35 +0000
commit4e5c92f331c508597324d1d6fcfe7aab7b3af3e1 (patch)
tree5797e0ffa7e932933f2dba9cd882263c1413da5f /usr.sbin/map-mbone
parentcbea8684273fed13015b15fbd6b9d3d8e134a67d (diff)
Fix possible buffer overflow in map-mbone's dns resolution; Jose Nazario
Diffstat (limited to 'usr.sbin/map-mbone')
-rw-r--r--usr.sbin/map-mbone/mapper.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/map-mbone/mapper.c b/usr.sbin/map-mbone/mapper.c
index 1313552ff9c..0f08a23f9dc 100644
--- a/usr.sbin/map-mbone/mapper.c
+++ b/usr.sbin/map-mbone/mapper.c
@@ -92,7 +92,7 @@ void ask2(u_int32_t dst);
int retry_requests(Node *node);
char * inet_name(u_int32_t addr);
void print_map(Node *node);
-char * graph_name(u_int32_t addr, char *buf);
+char * graph_name(u_int32_t addr, char *buf, size_t len);
void graph_edges(Node *node);
void elide_aliases(Node *node);
void graph_map(void);
@@ -693,14 +693,15 @@ void print_map(node)
}
-char *graph_name(addr, buf)
+char *graph_name(addr, buf, len)
u_int32_t addr;
char *buf;
+ size_t len;
{
char *name;
if (show_names && (name = inet_name(addr)))
- strcpy(buf, name);
+ strlcpy(buf, name, len);
else
inet_fmt(addr, buf);
@@ -713,7 +714,7 @@ void graph_edges(node)
{
Interface *ifc;
Neighbor *nb;
- char name[100];
+ char name[MAXHOSTNAMELEN];
if (node) {
graph_edges(node->left);
@@ -721,7 +722,7 @@ void graph_edges(node)
printf(" %d {$ NP %d0 %d0 $} \"%s%s\" \n",
(int) node->addr,
node->addr & 0xFF, (node->addr >> 8) & 0xFF,
- graph_name(node->addr, name),
+ graph_name(node->addr, name, sizeof(name)),
node->u.interfaces ? "" : "*");
for (ifc = node->u.interfaces; ifc; ifc = ifc->next)
for (nb = ifc->neighbors; nb; nb = nb->next) {