-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc | 22 | ||||
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh | 2 |
2 files changed, 15 insertions, 9 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc index 3d5a923..0630d04 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc | |||
@@ -11,3 +11,3 @@ | |||
11 | /* Adds a field to the buffer */ | 11 | /* Adds a field to the buffer */ |
12 | int add_field(char *buffer, char *string, int len) | 12 | int add_field(char *buffer, const char *string, int len) |
13 | { | 13 | { |
@@ -26,3 +26,3 @@ int add_field(char *buffer, char *string, int len) | |||
26 | 26 | ||
27 | int get_field(const char *buffer, char *out) | 27 | int get_field(const char *buffer, char *out, int maxlen) |
28 | { | 28 | { |
@@ -34,4 +34,8 @@ int get_field(const char *buffer, char *out) | |||
34 | /* Copy buffer to out pointer */ | 34 | /* Copy buffer to out pointer */ |
35 | memset(out, 0, atoi(len) + 1); | 35 | memset(out, 0, maxlen); |
36 | memcpy(out, buffer + 3, atoi(len)); | 36 | |
37 | if(atoi(len)-3 > maxlen -1) | ||
38 | memcpy(out, buffer + 3, maxlen - 1); | ||
39 | else | ||
40 | memcpy(out, buffer + 3, atoi(len)); | ||
37 | 41 | ||
@@ -102,3 +106,3 @@ int get_network_found (void *structure, const char *buffer) | |||
102 | memset(temp, 0, sizeof(temp)); | 106 | memset(temp, 0, sizeof(temp)); |
103 | len += get_field(buffer + len, temp); | 107 | len += get_field(buffer + len, temp, sizeof(temp)); |
104 | ptr->net_type = atoi(temp); | 108 | ptr->net_type = atoi(temp); |
@@ -107,3 +111,3 @@ int get_network_found (void *structure, const char *buffer) | |||
107 | memset(temp, 0, sizeof(temp)); | 111 | memset(temp, 0, sizeof(temp)); |
108 | len += get_field(buffer + len, temp); | 112 | len += get_field(buffer + len, temp, sizeof(temp)); |
109 | ptr->channel = atoi(temp); | 113 | ptr->channel = atoi(temp); |
@@ -112,3 +116,3 @@ int get_network_found (void *structure, const char *buffer) | |||
112 | memset(temp, 0, sizeof(temp)); | 116 | memset(temp, 0, sizeof(temp)); |
113 | len += get_field(buffer + len, temp); | 117 | len += get_field(buffer + len, temp, sizeof(temp)); |
114 | ptr->wep = atoi(temp); | 118 | ptr->wep = atoi(temp); |
@@ -116,6 +120,6 @@ int get_network_found (void *structure, const char *buffer) | |||
116 | /* Set MAC address */ | 120 | /* Set MAC address */ |
117 | len += get_field(buffer + len, ptr->mac); | 121 | len += get_field(buffer + len, ptr->mac, sizeof(ptr->mac)); |
118 | 122 | ||
119 | /* Set BSSID */ | 123 | /* Set BSSID */ |
120 | len += get_field(buffer + len, ptr->bssid); | 124 | len += get_field(buffer + len, ptr->bssid, sizeof(ptr->bssid)); |
121 | 125 | ||
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh index a196091..f645f58 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh +++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh | |||
@@ -15,2 +15,4 @@ | |||
15 | 15 | ||
16 | int add_field(char *, const char *, int); | ||
17 | int get_field(const char *, char *, int); | ||
16 | int send_network_found (const char *, int, void *); | 18 | int send_network_found (const char *, int, void *); |