summaryrefslogtreecommitdiff
authormjm <mjm>2002-12-28 15:28:49 (UTC)
committer mjm <mjm>2002-12-28 15:28:49 (UTC)
commit94ac3da47b0b36316cff680d319dab23c9339308 (patch) (side-by-side diff)
tree5161a4da84fb05c53fd5225be5674ab75087ff3f
parent0ab4ac99bead80d8af18988045748fd2b3dd3a15 (diff)
downloadopie-94ac3da47b0b36316cff680d319dab23c9339308.zip
opie-94ac3da47b0b36316cff680d319dab23c9339308.tar.gz
opie-94ac3da47b0b36316cff680d319dab23c9339308.tar.bz2
cleanup
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc46
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh2
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc0
3 files changed, 20 insertions, 28 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
@@ -43,11 +43,8 @@ int get_field(const char *buffer, char *out)
int send_network_found (const char *guihost, int guiport, void *structure)
{
wl_network_t *ptr;
- char buffer[2048];
- char temp[128];
- int retval=0, len=0;
-
- memset(temp, 0, sizeof(temp));
+ char buffer[2048], temp[5];
+ int len = 0;
ptr = (wl_network_t *)structure;
@@ -60,27 +57,26 @@ int send_network_found (const char *guihost, int guiport, void *structure)
/* Set Net-type */
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%d", ptr->net_type);
- retval = add_field(buffer + len, temp, 1);
- len += retval;
+ len += add_field(buffer + len, temp, 1);
/* Set channel */
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%.2d", ptr->channel);
- retval = add_field(buffer + len, temp, 2);
- len += retval;
+ len += add_field(buffer + len, temp, 2);
/* Set WEP y/n */
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%d", ptr->wep);
- retval = add_field(buffer + len, temp, 1);
- len += retval;
+ len += add_field(buffer + len, temp, 1);
/* Set Mac */
- retval = add_field(buffer + len, ptr->mac, 17);
- len += retval;
+ len += add_field(buffer + len, ptr->mac, 17);
/* Set ssid */
- retval = add_field(buffer + len, ptr->bssid, ptr->ssid_len);
+ 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
@@ -94,38 +90,34 @@ int send_network_found (const char *guihost, int guiport, void *structure)
int get_network_found (void *structure, const char *buffer)
{
wl_network_t *ptr;
- char temp[512];
- int retval=0, len=0;
+ char temp[5];
+ int len = 0;
ptr = (wl_network_t *)structure;
- /* packet type already determined */
+ /* packet type already determined, skip check */
len += 2;
- /* Get net type */
+ /* Get net type (accesspoint || ad-hoc || ...) */
memset(temp, 0, sizeof(temp));
- retval = get_field(buffer + len, temp);
- len += retval;
+ len += get_field(buffer + len, temp);
ptr->net_type = atoi(temp);
/* Get channel */
memset(temp, 0, sizeof(temp));
- retval = get_field(buffer + len, temp);
- len += retval;
+ len += get_field(buffer + len, temp);
ptr->channel = atoi(temp);
/* Set WEP y/n */
memset(temp, 0, sizeof(temp));
- retval = get_field(buffer + len, temp);
- len += retval;
+ len += get_field(buffer + len, temp);
ptr->wep = atoi(temp);
/* Set MAC address */
- retval = get_field(buffer + len, ptr->mac);
- len += retval;
+ len += get_field(buffer + len, ptr->mac);
/* Set BSSID */
- retval = get_field(buffer + len, ptr->bssid);
+ len += get_field(buffer + len, ptr->bssid);
return 1;
}
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
@@ -22,7 +22,7 @@ typedef struct {
int channel; /* Channel */
int wep; /* 1 = WEP enabled ; 0 = disabled */
char mac[64]; /* MAC address of Accesspoint */
- char bssid[128]; /* BSSID of Accesspoint */
+ char bssid[128]; /* BSSID of Net */
} wl_network_t;
#endif /* WLPROTO_HH */
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