aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/traceroute.c11
-rw-r--r--networking/udhcp/d6_dhcpc.c2
2 files changed, 2 insertions, 11 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 97a7a19e0..12ba614e8 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -387,15 +387,6 @@ struct globals {
#define outudp ((struct udphdr *)(outip + 1))
-/* libbb candidate? tftp uses this idiom too */
-static len_and_sockaddr* dup_sockaddr(const len_and_sockaddr *lsa)
-{
- len_and_sockaddr *new_lsa = xzalloc(LSA_LEN_SIZE + lsa->len);
- memcpy(new_lsa, lsa, LSA_LEN_SIZE + lsa->len);
- return new_lsa;
-}
-
-
static int
wait_for_reply(len_and_sockaddr *from_lsa, struct sockaddr *to, unsigned *timestamp_us, int *left_ms)
{
@@ -1074,7 +1065,7 @@ common_traceroute_main(int op, char **argv)
printf(" from %s", source);
printf(", %d hops max, %d byte packets\n", max_ttl, packlen);
- from_lsa = dup_sockaddr(dest_lsa);
+ from_lsa = xmemdup(dest_lsa, LSA_LEN_SIZE + dest_lsa->len);
lastaddr = xzalloc(dest_lsa->len);
to = xzalloc(dest_lsa->len);
seq = 0;
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 044f04673..4e9b705b9 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -118,7 +118,7 @@ static void *d6_copy_option(uint8_t *option, uint8_t *option_end, unsigned code)
uint8_t *opt = d6_find_option(option, option_end, code);
if (!opt)
return opt;
- return memcpy(xmalloc(opt[3] + 4), opt, opt[3] + 4);
+ return xmemdup(opt, opt[3] + 4);
}
static void *d6_store_blob(void *dst, const void *src, unsigned len)