summaryrefslogtreecommitdiff
authormjm <mjm>2002-12-28 15:45:35 (UTC)
committer mjm <mjm>2002-12-28 15:45:35 (UTC)
commit3e11085619fabc4d25bb831bebbae189accfe4bf (patch) (side-by-side diff)
treee6f15cf4c707bbd5577eed364b01f20f152ede14
parentb8ade08c754775d594192e79f33ea9ecc1a3686c (diff)
downloadopie-3e11085619fabc4d25bb831bebbae189accfe4bf.zip
opie-3e11085619fabc4d25bb831bebbae189accfe4bf.tar.gz
opie-3e11085619fabc4d25bb831bebbae189accfe4bf.tar.bz2
securityfix for get_field, updated header file
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc22
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh2
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 @@
/* Adds a field to the buffer */
-int add_field(char *buffer, char *string, int len)
+int add_field(char *buffer, const char *string, int len)
{
@@ -26,3 +26,3 @@ int add_field(char *buffer, char *string, int len)
-int get_field(const char *buffer, char *out)
+int get_field(const char *buffer, char *out, int maxlen)
{
@@ -34,4 +34,8 @@ int get_field(const char *buffer, char *out)
/* Copy buffer to out pointer */
- memset(out, 0, atoi(len) + 1);
- memcpy(out, buffer + 3, atoi(len));
+ memset(out, 0, maxlen);
+
+ if(atoi(len)-3 > maxlen -1)
+ memcpy(out, buffer + 3, maxlen - 1);
+ else
+ memcpy(out, buffer + 3, atoi(len));
@@ -102,3 +106,3 @@ int get_network_found (void *structure, const char *buffer)
memset(temp, 0, sizeof(temp));
- len += get_field(buffer + len, temp);
+ len += get_field(buffer + len, temp, sizeof(temp));
ptr->net_type = atoi(temp);
@@ -107,3 +111,3 @@ int get_network_found (void *structure, const char *buffer)
memset(temp, 0, sizeof(temp));
- len += get_field(buffer + len, temp);
+ len += get_field(buffer + len, temp, sizeof(temp));
ptr->channel = atoi(temp);
@@ -112,3 +116,3 @@ int get_network_found (void *structure, const char *buffer)
memset(temp, 0, sizeof(temp));
- len += get_field(buffer + len, temp);
+ len += get_field(buffer + len, temp, sizeof(temp));
ptr->wep = atoi(temp);
@@ -116,6 +120,6 @@ int get_network_found (void *structure, const char *buffer)
/* Set MAC address */
- len += get_field(buffer + len, ptr->mac);
+ len += get_field(buffer + len, ptr->mac, sizeof(ptr->mac));
/* Set BSSID */
- len += get_field(buffer + len, ptr->bssid);
+ len += get_field(buffer + len, ptr->bssid, sizeof(ptr->bssid));
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 @@
+int add_field(char *, const char *, int);
+int get_field(const char *, char *, int);
int send_network_found (const char *, int, void *);