While iterating over string characters don't use strlen(), but check for NUL.

svn path=/trunk/; revision=42883
This commit is contained in:
Jakub Zawadzki 2012-05-28 15:59:00 +00:00
parent bb08a70594
commit 5020a3f170
4 changed files with 6 additions and 7 deletions

View File

@ -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];
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}