ThreadNetworkDiagnostics: Encode the Extended address as an big-endian integer (#38472)

* ThreadNetworkDiagnostics: Encode the Extended address as a big-endian integer

* review changes
diff --git a/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp b/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp
index 5c73f93..504cd27 100644
--- a/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp
+++ b/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp
@@ -682,7 +682,10 @@
         }
         else
         {
-            err = encoder.Encode(*(uint64_t *) extAddress->m8);
+            // This attribute's value is composed by taking the 8 octets of the extended address EUI-64 and
+            // treating them as a big-endian integer.
+            static_assert(sizeof(extAddress->m8) == sizeof(uint64_t), "Unexpected buffer size");
+            err = encoder.Encode(Encoding::BigEndian::Get64(extAddress->m8));
         }
     }
     break;