3 files changed, 23 insertions, 31 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc index 5317f52..ae6d406 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc | |||
@@ -45,7 +45,4 @@ int send_network_found (const char *guihost, int guiport, void *structure) | |||
45 | wl_network_t *ptr; | 45 | wl_network_t *ptr; |
46 | char buffer[2048]; | 46 | char buffer[2048], temp[5]; |
47 | char temp[128]; | 47 | int len = 0; |
48 | int retval=0, len=0; | ||
49 | |||
50 | memset(temp, 0, sizeof(temp)); | ||
51 | 48 | ||
@@ -62,4 +59,3 @@ int send_network_found (const char *guihost, int guiport, void *structure) | |||
62 | snprintf(temp, sizeof(temp), "%d", ptr->net_type); | 59 | snprintf(temp, sizeof(temp), "%d", ptr->net_type); |
63 | retval = add_field(buffer + len, temp, 1); | 60 | len += add_field(buffer + len, temp, 1); |
64 | len += retval; | ||
65 | 61 | ||
@@ -68,4 +64,3 @@ int send_network_found (const char *guihost, int guiport, void *structure) | |||
68 | snprintf(temp, sizeof(temp), "%.2d", ptr->channel); | 64 | snprintf(temp, sizeof(temp), "%.2d", ptr->channel); |
69 | retval = add_field(buffer + len, temp, 2); | 65 | len += add_field(buffer + len, temp, 2); |
70 | len += retval; | ||
71 | 66 | ||
@@ -74,11 +69,12 @@ int send_network_found (const char *guihost, int guiport, void *structure) | |||
74 | snprintf(temp, sizeof(temp), "%d", ptr->wep); | 69 | snprintf(temp, sizeof(temp), "%d", ptr->wep); |
75 | retval = add_field(buffer + len, temp, 1); | 70 | len += add_field(buffer + len, temp, 1); |
76 | len += retval; | ||
77 | 71 | ||
78 | /* Set Mac */ | 72 | /* Set Mac */ |
79 | retval = add_field(buffer + len, ptr->mac, 17); | 73 | len += add_field(buffer + len, ptr->mac, 17); |
80 | len += retval; | ||
81 | 74 | ||
82 | /* Set ssid */ | 75 | /* Set ssid */ |
83 | retval = add_field(buffer + len, ptr->bssid, ptr->ssid_len); | 76 | if(len + ptr->ssid_len < sizeof(buffer) - 1) |
77 | len += add_field(buffer + len, ptr->bssid, ptr->ssid_len); | ||
78 | else | ||
79 | len += add_field(buffer + len, ptr->bssid, sizeof(buffer) - len - 1); | ||
84 | 80 | ||
@@ -96,4 +92,4 @@ int get_network_found (void *structure, const char *buffer) | |||
96 | wl_network_t *ptr; | 92 | wl_network_t *ptr; |
97 | char temp[512]; | 93 | char temp[5]; |
98 | int retval=0, len=0; | 94 | int len = 0; |
99 | 95 | ||
@@ -101,9 +97,8 @@ int get_network_found (void *structure, const char *buffer) | |||
101 | 97 | ||
102 | /* packet type already determined */ | 98 | /* packet type already determined, skip check */ |
103 | len += 2; | 99 | len += 2; |
104 | 100 | ||
105 | /* Get net type */ | 101 | /* Get net type (accesspoint || ad-hoc || ...) */ |
106 | memset(temp, 0, sizeof(temp)); | 102 | memset(temp, 0, sizeof(temp)); |
107 | retval = get_field(buffer + len, temp); | 103 | len += get_field(buffer + len, temp); |
108 | len += retval; | ||
109 | ptr->net_type = atoi(temp); | 104 | ptr->net_type = atoi(temp); |
@@ -112,4 +107,3 @@ int get_network_found (void *structure, const char *buffer) | |||
112 | memset(temp, 0, sizeof(temp)); | 107 | memset(temp, 0, sizeof(temp)); |
113 | retval = get_field(buffer + len, temp); | 108 | len += get_field(buffer + len, temp); |
114 | len += retval; | ||
115 | ptr->channel = atoi(temp); | 109 | ptr->channel = atoi(temp); |
@@ -118,4 +112,3 @@ int get_network_found (void *structure, const char *buffer) | |||
118 | memset(temp, 0, sizeof(temp)); | 112 | memset(temp, 0, sizeof(temp)); |
119 | retval = get_field(buffer + len, temp); | 113 | len += get_field(buffer + len, temp); |
120 | len += retval; | ||
121 | ptr->wep = atoi(temp); | 114 | ptr->wep = atoi(temp); |
@@ -123,7 +116,6 @@ int get_network_found (void *structure, const char *buffer) | |||
123 | /* Set MAC address */ | 116 | /* Set MAC address */ |
124 | retval = get_field(buffer + len, ptr->mac); | 117 | len += get_field(buffer + len, ptr->mac); |
125 | len += retval; | ||
126 | 118 | ||
127 | /* Set BSSID */ | 119 | /* Set BSSID */ |
128 | retval = get_field(buffer + len, ptr->bssid); | 120 | len += get_field(buffer + len, ptr->bssid); |
129 | 121 | ||
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh index f755589..a196091 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh +++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh | |||
@@ -24,3 +24,3 @@ typedef struct { | |||
24 | char mac[64]; /* MAC address of Accesspoint */ | 24 | char mac[64]; /* MAC address of Accesspoint */ |
25 | char bssid[128]; /* BSSID of Accesspoint */ | 25 | char bssid[128]; /* BSSID of Net */ |
26 | } wl_network_t; | 26 | } wl_network_t; |
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc index 4942fba..db6b7b8 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc | |||
@@ -15,3 +15,3 @@ int wl_setupsock(const char *host, int port) | |||
15 | 15 | ||
16 | if((sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0) | 16 | if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) |
17 | { | 17 | { |
@@ -55,3 +55,3 @@ int wl_send(const char *host, int port, const char *string, ...) | |||
55 | /* Setup socket */ | 55 | /* Setup socket */ |
56 | if((sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0) | 56 | if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) |
57 | { | 57 | { |
@@ -78,3 +78,3 @@ int wl_recv(int *sock, char *out, int maxlen) | |||
78 | struct sockaddr_in *cliaddr; | 78 | struct sockaddr_in *cliaddr; |
79 | socklen_t len=sizeof(struct sockaddr); | 79 | socklen_t len = sizeof(struct sockaddr); |
80 | char retval[3]; | 80 | char retval[3]; |