MINOR: tools: buf2ip6 must not modify output on failure

Use a temporary output buffer to ensure we don't affect the output
on failure of inet_pton().
diff --git a/src/standard.c b/src/standard.c
index ebbc70c..72fd0d6 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -1644,6 +1644,7 @@
  * or the number of chars read in case of success. Maybe this could be replaced
  * by one of the functions above. Also, apparently this function does not support
  * hosts above 255 and requires exactly 4 octets.
+ * The destination is only modified on success.
  */
 int buf2ip(const char *buf, size_t len, struct in_addr *dst)
 {
@@ -1695,10 +1696,12 @@
 /* This function converts the string in <buf> of the len <len> to
  * struct in6_addr <dst> which must be allocated by the caller.
  * This function returns 1 in success case, otherwise zero.
+ * The destination is only modified on success.
  */
 int buf2ip6(const char *buf, size_t len, struct in6_addr *dst)
 {
 	char null_term_ip6[INET6_ADDRSTRLEN + 1];
+	struct in6_addr out;
 
 	if (len > INET6_ADDRSTRLEN)
 		return 0;
@@ -1706,9 +1709,10 @@
 	memcpy(null_term_ip6, buf, len);
 	null_term_ip6[len] = '\0';
 
-	if (!inet_pton(AF_INET6, null_term_ip6, dst))
+	if (!inet_pton(AF_INET6, null_term_ip6, &out))
 		return 0;
 
+	*dst = out;
 	return 1;
 }