diff options
author | Gerald Combs <gerald@wireshark.org> | 2009-02-17 23:15:35 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2009-02-17 23:15:35 +0000 |
commit | 95ddd62076702f852171c45310176bd364504e5c (patch) | |
tree | 1e3d150da91b385a2687d42db7333a849bf520ba /epan/strutil.c | |
parent | f490cdd7fc936bcce0f9db042a22737117b7cfe2 (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.
svn path=/trunk/; revision=27478
Diffstat (limited to 'epan/strutil.c')
-rw-r--r-- | epan/strutil.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/epan/strutil.c b/epan/strutil.c index f89e17a511..724d595314 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -951,3 +951,11 @@ epan_strcasestr(const char *haystack, const char *needle) } return NULL; } + +const char * +string_or_null(const char *string) +{ + if (string) + return string; + return "[NULL]"; +} |