From ea54b844fb8d41241db5cd2088319e226cfd8b68 Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周六, 16 5月 2020 22:08:05 +0800
Subject: [PATCH] tentative fix for issue #92 and #97

---
 src/library/os/network.hpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/library/os/network.hpp b/src/library/os/network.hpp
index 6ba1611..5ddf266 100644
--- a/src/library/os/network.hpp
+++ b/src/library/os/network.hpp
@@ -17,9 +17,17 @@
 
 typedef enum { IFACE_TYPE_ETHERNET, IFACE_TYPE_WIRELESS } IFACE_TYPE;
 
+#ifdef __unix__
+#include <netdb.h>
+#define LCC_ADAPTER_DESCRIPTION_LEN NI_MAXHOST
+#else
+#include <iphlpapi.h>
+#define LCC_ADAPTER_DESCRIPTION_LEN MAX_ADAPTER_DESCRIPTION_LENGTH
+#endif
+
 typedef struct {
 	int id;
-	char description[1024];
+	char description[LCC_ADAPTER_DESCRIPTION_LEN + 1];
 	unsigned char mac_address[8];
 	unsigned char ipv4_address[4];
 	IFACE_TYPE type;

--
Gitblit v1.9.1