author | mjm <mjm> | 2003-01-05 11:18:27 (UTC) |
---|---|---|
committer | mjm <mjm> | 2003-01-05 11:18:27 (UTC) |
commit | 3eecce3109b543a5abd6a36a420fa3f53cc23023 (patch) (side-by-side diff) | |
tree | 5e92d6ec8a4ebc58822bed5de48706ed51a7ebd0 /noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc | |
parent | 4f45c61a4e778a8124ae362dd5339b329b171441 (diff) | |
download | opie-3eecce3109b543a5abd6a36a420fa3f53cc23023.zip opie-3eecce3109b543a5abd6a36a420fa3f53cc23023.tar.gz opie-3eecce3109b543a5abd6a36a420fa3f53cc23023.tar.bz2 |
general code cleanup, wrote configfileparser, ...
Diffstat (limited to 'noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc index 664ba92..67dfc02 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc @@ -15,6 +15,7 @@ int add_field(char *buffer, const char *string, int len) char newlen[5]; /* 3 Byte = Length */ + memset(newlen, 0, sizeof(newlen)); snprintf(newlen, sizeof(newlen) - 1, "%.3d", len); memcpy(buffer, newlen, 3); @@ -30,11 +31,11 @@ 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 @@ -53,6 +54,8 @@ int send_network_found (const char *guihost, int guiport, void *structure) ptr = (wl_network_t *)structure; + memcpy(buffer, 0, sizeof(buffer)); + /* Type = Found new net (without length field) */ memset(temp, 0, sizeof(temp)); snprintf(temp, sizeof(temp), "%.2d", WL_NETFOUND); |