[UBSan][roughtime] Fix unaligned reads, reenable UBSan

It is undefined behavior to attempt to dereference an unaligned pointer,
which is very easy to do any time you reinterpret_cast a pointer that
you obtained by parsing some bytes that aren't guaranteed to be aligned.

The canonical answer is to use memcpy to copy the bytes into an aligned
structure, and to use that aligned structure.  Here, we already have the
intended out pointer, so we can simply perform the bytewise copy.

Test: fx test network-time-service-tests
Fixed: 47040
Change-Id: I39b98804261fff4e76c064c5b8bf9e6fa88f3bbb
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/roughtime/+/460140
Reviewed-by: Jody Sankey <jsankey@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 4e23013..5bc2bb8 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -57,9 +57,6 @@
     "//third_party/glog",
   ]
 
-  # TODO(47040): UBSan has found an instance of undefined behavior in this target.
-  # Disable UBSan for this target temporarily until it is migrated into CI/CQ.
-  configs += [ "//build/config:temporarily_disable_ubsan_do_not_use" ]
   # TODO(fxb/58162): delete the below and fix compiler warnings
   configs += [ "//build/config:Wno-conversion" ]
 }
@@ -77,9 +74,6 @@
     "//third_party/glog",
   ]
 
-  # TODO(47040): UBSan has found an instance of undefined behavior in this target.
-  # Disable UBSan for this target temporarily until it is migrated into CI/CQ.
-  configs += [ "//build/config:temporarily_disable_ubsan_do_not_use" ]
   # TODO(fxb/58162): delete the below and fix compiler warnings
   configs += [ "//build/config:Wno-conversion" ]
 }
diff --git a/protocol.cc b/protocol.cc
index 744dc04..c70e940 100644
--- a/protocol.cc
+++ b/protocol.cc
@@ -163,7 +163,7 @@
       len != sizeof(T)) {
     return false;
   }
-  *out_value = *reinterpret_cast<const T *>(data);
+  memcpy(out_value, data, sizeof(T));
   return true;
 }