aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2012-05-28 15:59:00 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2012-05-28 15:59:00 +0000
commit5020a3f170972d7093f80a09b5f360548cc460eb (patch)
tree80cb9541c1e9803049d7920f6ac713c96140efc0
parentbb08a70594a288eb2f5dc9ab4a853a5baf16ac27 (diff)
While iterating over string characters don't use strlen(), but check for NUL.
svn path=/trunk/; revision=42883
-rw-r--r--epan/dissectors/packet-dcerpc-netlogon.c7
-rw-r--r--epan/dissectors/packet-gssapi.c2
-rw-r--r--epan/proto.c2
-rw-r--r--epan/strutil.c2
4 files changed, 6 insertions, 7 deletions
diff --git a/epan/dissectors/packet-dcerpc-netlogon.c b/epan/dissectors/packet-dcerpc-netlogon.c
index 04d494fa1d..7156c0ff2d 100644
--- a/epan/dissectors/packet-dcerpc-netlogon.c
+++ b/epan/dissectors/packet-dcerpc-netlogon.c
@@ -472,8 +472,7 @@ typedef struct _seen_packet {
} seen_packet;
static seen_packet seen;
-guint
-netlogon_auth_hash (gconstpointer k);
+
static e_uuid_t uuid_dcerpc_netlogon = {
0x12345678, 0x1234, 0xabcd,
{ 0xef, 0x00, 0x01, 0x23, 0x45, 0x67, 0xcf, 0xfb }
@@ -590,7 +589,7 @@ netlogon_auth_equal (gconstpointer k1, gconstpointer k2)
ADDRESSES_EQUAL(&key1->dst,&key2->dst));
}
-guint
+static guint
netlogon_auth_hash (gconstpointer k)
{
const netlogon_auth_key *key1 = (const netlogon_auth_key *)k;
@@ -602,7 +601,7 @@ netlogon_auth_hash (gconstpointer k)
else {
unsigned int i = 0;
hash_val1 = 0;
- for(i=0; i<strlen(key1->name);i++) {
+ for(i=0; key1->name[i]; i++) {
hash_val1 += key1->name[i];
}
}
diff --git a/epan/dissectors/packet-gssapi.c b/epan/dissectors/packet-gssapi.c
index b23d7a90c6..65ec2c462c 100644
--- a/epan/dissectors/packet-gssapi.c
+++ b/epan/dissectors/packet-gssapi.c
@@ -133,7 +133,7 @@ gssapi_oid_hash(gconstpointer k)
const char *key = (const char *)k;
guint hash = 0, i;
- for (i = 0; i < strlen(key); i++)
+ for (i = 0; key[i]; i++)
hash += key[i];
return hash;
diff --git a/epan/proto.c b/epan/proto.c
index e9a86f2ed2..e9029844a5 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -4443,7 +4443,7 @@ proto_register_protocol(const char *name, const char *short_name,
g_hash_table_insert(proto_short_names, (gpointer)short_name, (gpointer)short_name);
found_invalid = FALSE;
- for (i = 0; i < strlen(filter_name); i++) {
+ for (i = 0; filter_name[i]; i++) {
c = filter_name[i];
if (!(islower(c) || isdigit(c) || c == '-' || c == '_' || c == '.')) {
found_invalid = TRUE;
diff --git a/epan/strutil.c b/epan/strutil.c
index 0ae68824aa..d02144688d 100644
--- a/epan/strutil.c
+++ b/epan/strutil.c
@@ -579,7 +579,7 @@ format_uri(const GByteArray *bytes, const gchar *reserved_chars)
is_reserved = TRUE;
}
- for (i = 0; i < strlen(reserved); i++) {
+ for (i = 0; reserved[i]; i++) {
if (c == reserved[i])
is_reserved = TRUE;
}