Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/othptab.c | 9 +++++----
src/rvnamed.c | 21 +++++++++------------
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/othptab.c b/src/othptab.c
index ef5587b..6b77336 100644
--- a/src/othptab.c
+++ b/src/othptab.c
@@ -235,9 +235,10 @@ struct othptabent *add_othp_entry(struct othptable *table, struct
pkt_hdr *pkt,
new_entry->un.ospf.area =
ntohl(((struct ospfhdr *) packet2)->
ospf_areaid.s_addr);
- strcpy(new_entry->un.ospf.routerid,
- inet_ntoa(((struct ospfhdr *)
- packet2)->ospf_routerid));
+ inet_ntop(AF_INET,
+ &((struct ospfhdr *)packet2)->ospf_routerid,
+ new_entry->un.ospf.routerid,
+ sizeof(new_entry->un.ospf.routerid));
}
}
} else {
@@ -400,7 +401,7 @@ void printothpentry(struct othptable *table, struct othptabent
*entry,
break;
}
- sprintf(scratchpad, inet_ntoa(saddr));
+ inet_ntop(AF_INET, &saddr, scratchpad, sizeof(scratchpad));
strcat(msgstring, scratchpad);
wattrset(table->othpwin, ARPATTR);
break;
diff --git a/src/rvnamed.c b/src/rvnamed.c
index a0a4f5f..a663b85 100644
--- a/src/rvnamed.c
+++ b/src/rvnamed.c
@@ -97,7 +97,8 @@ static void process_rvn_packet(struct rvn *rvnpacket)
if (he == NULL) {
if (rvnpacket->saddr.s_addr != 0)
- strcpy(rvnpacket->fqdn, inet_ntoa(rvnpacket->saddr));
+ inet_ntop(AF_INET, &rvnpacket->saddr,
+ rvnpacket->fqdn, sizeof(rvnpacket->fqdn));
else
inet_ntop(AF_INET6, &(rvnpacket->s6addr),
rvnpacket->fqdn, sizeof(rvnpacket->fqdn));
@@ -506,19 +507,15 @@ int main(void)
rvnpacket.type = RVN_REPLY;
memset(rvnpacket.fqdn, 0, sizeof(rvnpacket.fqdn));
if (rvnpacket.saddr.s_addr != 0)
- strcpy(rvnpacket.fqdn,
- inet_ntoa
- (rvnpacket.
- saddr));
+ inet_ntop(AF_INET,
+ &rvnpacket.saddr,
+ rvnpacket.fqdn,
+ sizeof(rvnpacket.fqdn));
else
inet_ntop(AF_INET6,
- &rvnpacket.
- s6addr,
- rvnpacket.
- fqdn,
- sizeof
- (rvnpacket.
- fqdn));
+ &rvnpacket.s6addr,
+ rvnpacket.fqdn,
+ sizeof(rvnpacket.fqdn));
rvnpacket.ready = RESOLVING;
br = sendto(ifd, &rvnpacket,
--
1.7.8.4