aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2009-02-17 23:15:35 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2009-02-17 23:15:35 +0000
commit1fcd4d13044cf3a513ae656c48386d9fbd4eecd2 (patch)
tree1e3d150da91b385a2687d42db7333a849bf520ba /asn1
parente9753da266e4e4cf86d8e477fbd05c7ab88578bc (diff)
Add a string utility function "string_or_null" which can be used to
guarantee a non-null string value. Use it in the LDAP dissector. Fixes the crash on Windows (and other platforms) reported in bug 3262. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27478 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'asn1')
-rw-r--r--asn1/ldap/ldap.cnf34
1 files changed, 14 insertions, 20 deletions
diff --git a/asn1/ldap/ldap.cnf b/asn1/ldap/ldap.cnf
index 8c095aa49f..c472aaedc0 100644
--- a/asn1/ldap/ldap.cnf
+++ b/asn1/ldap/ldap.cnf
@@ -536,34 +536,26 @@ ldap_conv_info_t *ldap_info;
#.FN_FTR Filter/equalityMatch
Filter_string=ep_strdup_printf("(%s=%s)",
- attributedesc_string ?
- attributedesc_string : "(null)",
- ldapvalue_string ?
- ldapvalue_string : "(null)");
+ string_or_null(attributedesc_string),
+ string_or_null(ldapvalue_string));
#.FN_FTR Filter/greaterOrEqual
Filter_string=ep_strdup_printf("(%s>=%s)",
- attributedesc_string ?
- attributedesc_string : "(null)",
- ldapvalue_string ?
- ldapvalue_string : "(null)");
+ string_or_null(attributedesc_string),
+ string_or_null(ldapvalue_string));
#.FN_FTR Filter/lessOrEqual
Filter_string=ep_strdup_printf("(%s<=%s)",
- attributedesc_string ?
- attributedesc_string : "(null)",
- ldapvalue_string ?
- ldapvalue_string : "(null)");
+ string_or_null(attributedesc_string),
+ string_or_null(ldapvalue_string));
#.FN_FTR Filter/approxMatch
Filter_string=ep_strdup_printf("(%s~=%s)",
- attributedesc_string ?
- attributedesc_string : "(null)",
- ldapvalue_string ?
- ldapvalue_string : "(null)");
+ string_or_null(attributedesc_string),
+ string_or_null(ldapvalue_string));
#.FN_FTR Filter/and/_item
if(and_filter_string){
@@ -619,10 +611,10 @@ ldap_conv_info_t *ldap_info;
or_filter_string=old_or_filter_string;
#.FN_FTR Filter/present
- Filter_string=ep_strdup_printf("(%s=*)",Filter_string);
+ Filter_string=ep_strdup_printf("(%s=*)",string_or_null(Filter_string));
#.FN_FTR Filter/not
- Filter_string=ep_strdup_printf("(!%s)",Filter_string);
+ Filter_string=ep_strdup_printf("(!%s)",string_or_null(Filter_string));
#.FN_BODY MatchingRuleAssertion/dnAttributes
gboolean val;
@@ -676,7 +668,9 @@ offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &v
tree = tr;
}
%(DEFAULT_BODY)s
- Filter_string=ep_strdup_printf("(%%s=%%s)",attr_type,substring_value);
+ Filter_string=ep_strdup_printf("(%%s=%%s)",
+ string_or_null(attr_type),
+ string_or_null(substring_value));
proto_item_append_text(it, "%%s", Filter_string);
substring_value=old_substring_value;
@@ -691,7 +685,7 @@ offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &v
}
%(DEFAULT_BODY)s
if(Filter_string)
- proto_item_append_text(it, "%%s", Filter_string);
+ proto_item_append_text(it, "%%s", string_or_null(Filter_string));
#.FN_BODY AuthenticationChoice/ntlmsspNegotiate
/* make sure the protocol op comes first */