summaryrefslogtreecommitdiff
authormax <max>2003-02-07 10:01:23 (UTC)
committer max <max>2003-02-07 10:01:23 (UTC)
commite73acff447949c3e87da87e0749ccefac448d650 (patch) (unidiff)
treeb68e69e04fd4730c0c0adbc2c506d98d4747ba99
parent1561b2314308255c1fb181f1c979b38962c51373 (diff)
downloadopie-e73acff447949c3e87da87e0749ccefac448d650.zip
opie-e73acff447949c3e87da87e0749ccefac448d650.tar.gz
opie-e73acff447949c3e87da87e0749ccefac448d650.tar.bz2
Bugfix memset
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
@@ -33,50 +33,49 @@ int get_field(const char *buffer, char *out, int maxlen)
33 /* Get length of value */ 33 /* Get length of value */
34 memset(len, 0, sizeof(len)); 34 memset(len, 0, sizeof(len));
35 memcpy(len, buffer, 3); 35 memcpy(len, buffer, 3);
36 36
37 /* Copy buffer to out pointer */ 37 /* Copy buffer to out pointer */
38 memset(out, 0, maxlen); 38 memset(out, 0, maxlen);
39 if(atoi(len) > maxlen -1) 39 if(atoi(len) > maxlen -1)
40 memcpy(out, buffer + 3, maxlen - 1); 40 memcpy(out, buffer + 3, maxlen - 1);
41 else 41 else
42 memcpy(out, buffer + 3, atoi(len)); 42 memcpy(out, buffer + 3, atoi(len));
43 43
44 /* Return length of whole field (including 3 byte length) */ 44 /* Return length of whole field (including 3 byte length) */
45 return (atoi(len) + 3); 45 return (atoi(len) + 3);
46} 46}
47 47
48/* Send found network to UI */ 48/* Send found network to UI */
49int send_network_found (const char *guihost, int guiport, void *structure) 49int send_network_found (const char *guihost, int guiport, void *structure)
50{ 50{
51 wl_network_t *ptr; 51 wl_network_t *ptr;
52 char buffer[2048], temp[5]; 52 char buffer[2048], temp[5];
53 unsigned int len = 0; 53 unsigned int len = 0;
54 54
55 ptr = (wl_network_t *)structure; 55 ptr = (wl_network_t *)structure;
56 56
57 memcpy(buffer, 0, sizeof(buffer)); 57 memset(buffer,0,sizeof(buffer));
58
59 /* Type = Found new net (without length field) */ 58 /* Type = Found new net (without length field) */
60 memset(temp, 0, sizeof(temp)); 59 memset(temp, 0, sizeof(temp));
61 snprintf(temp, sizeof(temp), "%.2d", WL_NETFOUND); 60 snprintf(temp, sizeof(temp), "%.2d", WL_NETFOUND);
62 memcpy(buffer, temp, 2); 61 memcpy(buffer, temp, 2);
63 len += 2; 62 len += 2;
64 63
65 /* Set Net-type */ 64 /* Set Net-type */
66 memset(temp, 0, sizeof(temp)); 65 memset(temp, 0, sizeof(temp));
67 snprintf(temp, sizeof(temp), "%d", ptr->net_type); 66 snprintf(temp, sizeof(temp), "%d", ptr->net_type);
68 len += add_field(buffer + len, temp, 1); 67 len += add_field(buffer + len, temp, 1);
69 68
70 /* Set channel */ 69 /* Set channel */
71 memset(temp, 0, sizeof(temp)); 70 memset(temp, 0, sizeof(temp));
72 snprintf(temp, sizeof(temp), "%.2d", ptr->channel); 71 snprintf(temp, sizeof(temp), "%.2d", ptr->channel);
73 len += add_field(buffer + len, temp, 2); 72 len += add_field(buffer + len, temp, 2);
74 73
75 /* Set WEP y/n */ 74 /* Set WEP y/n */
76 memset(temp, 0, sizeof(temp)); 75 memset(temp, 0, sizeof(temp));
77 snprintf(temp, sizeof(temp), "%d", ptr->wep); 76 snprintf(temp, sizeof(temp), "%d", ptr->wep);
78 len += add_field(buffer + len, temp, 1); 77 len += add_field(buffer + len, temp, 1);
79 78
80 /* Set Mac */ 79 /* Set Mac */
81 len += add_field(buffer + len, ptr->mac, 17); 80 len += add_field(buffer + len, ptr->mac, 17);
82 81