summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
index 67dfc02..0d0f075 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
@@ -25,66 +25,65 @@ int add_field(char *buffer, const char *string, int len)
/* Return length of attached field */
return (atoi(newlen) + 3);
}
int get_field(const char *buffer, char *out, int maxlen)
{
char len[5];
/* Get length of value */
memset(len, 0, sizeof(len));
memcpy(len, buffer, 3);
/* Copy buffer to out pointer */
memset(out, 0, maxlen);
if(atoi(len) > maxlen -1)
memcpy(out, buffer + 3, maxlen - 1);
else
memcpy(out, buffer + 3, atoi(len));
/* Return length of whole field (including 3 byte length) */
return (atoi(len) + 3);
}
/* Send found network to UI */
int send_network_found (const char *guihost, int guiport, void *structure)
{
wl_network_t *ptr;
char buffer[2048], temp[5];
unsigned int len = 0;
ptr = (wl_network_t *)structure;
- memcpy(buffer, 0, sizeof(buffer));
-
+ memset(buffer,0,sizeof(buffer));
/* Type = Found new net (without length field) */
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%.2d", WL_NETFOUND);
memcpy(buffer, temp, 2);
len += 2;
/* Set Net-type */
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%d", ptr->net_type);
len += add_field(buffer + len, temp, 1);
/* Set channel */
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%.2d", ptr->channel);
len += add_field(buffer + len, temp, 2);
/* Set WEP y/n */
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%d", ptr->wep);
len += add_field(buffer + len, temp, 1);
/* Set Mac */
len += add_field(buffer + len, ptr->mac, 17);
/* Set ssid */
if(len + ptr->ssid_len < sizeof(buffer) - 1)
len += add_field(buffer + len, ptr->bssid, ptr->ssid_len);
else
len += add_field(buffer + len, ptr->bssid, sizeof(buffer) - len - 1);
/* Send prepared buffer to UI */
#ifdef DEBUG