diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-05-16 11:48:15 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-05-16 19:15:40 +0000 |
commit | 1942fa9e5a338bcfb53ee7b77623df0ac8380538 (patch) | |
tree | 4abe91cf591cb473f7b98d6f0b579014f1762684 /epan/dissectors/packet-dcm.c | |
parent | 576f33fffd4384d869ae516aa3f346d2ce0b4c6b (diff) |
Do *NOT* assume col_get_text(cinfo, el) never returns NULL!
It can, and, in at least one capture, it does.
Change-Id: Id3540e6551db5d63427f09c6ccc521958ecccac6
Reviewed-on: https://code.wireshark.org/review/33231
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-dcm.c')
-rw-r--r-- | epan/dissectors/packet-dcm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index c4cb1120db..71f3b0c94d 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -3887,7 +3887,9 @@ Only set a valued with col_set_str() if it does not yet exist. */ void col_set_str_conditional(column_info *cinfo, const gint el, const gchar* str) { - if (!g_str_has_prefix(col_get_text(cinfo, el), str)) + const char *col_string = col_get_text(cinfo, el); + + if (col_string == NULL || !g_str_has_prefix(col_string, str)) { col_add_str(cinfo, el, str); } @@ -3898,7 +3900,9 @@ CSV add a value to a column, if it does not exist yet */ void col_append_str_conditional(column_info *cinfo, const gint el, const gchar* str) { - if (!g_strrstr(col_get_text(cinfo, el), str)) + const char *col_string = col_get_text(cinfo, el); + + if (col_string == NULL || !g_strrstr(col_string, str)) { col_append_fstr(cinfo, el, ", %s", str); } |