diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-12-05 13:04:59 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-12-05 21:05:51 +0000 |
commit | b98c570969870f1b0aec9c4165d35ab9c5db8673 (patch) | |
tree | 70c93462046b6b9de9c36419969789a70921a5b1 /epan/column-utils.c | |
parent | 18fabb4733336896f94e3a785f0f7c663ff9ae72 (diff) |
Fix varargs handling in col_{add,append}_lstr().
We do multiple va_start() calls using the first string in the list of
strings; do *not* use the first-string argument to iterate over all the
argument strings, as that means that only the first va_start() call will
do the right thing, use a separate variable.
Bug: 10755
Change-Id: Ic4a6c24f911e335d147883a25d30289628836875
Reviewed-on: https://code.wireshark.org/review/5630
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/column-utils.c')
-rw-r--r-- | epan/column-utils.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c index 0de9a7c914..44b855fb23 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -325,11 +325,12 @@ col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo) } void -col_append_lstr(column_info *cinfo, const gint el, const gchar *str, ...) +col_append_lstr(column_info *cinfo, const gint el, const gchar *str1, ...) { va_list ap; size_t pos, max_len; int i; + const gchar *str; if (!CHECK_COL(cinfo, el)) return; @@ -350,7 +351,8 @@ col_append_lstr(column_info *cinfo, const gint el, const gchar *str, ...) if (pos >= max_len) return; - va_start(ap, str); + va_start(ap, str1); + str = str1; do { if G_UNLIKELY(str == NULL) str = "(null)"; @@ -609,12 +611,13 @@ col_set_str(column_info *cinfo, const gint el, const gchar* str) } void -col_add_lstr(column_info *cinfo, const gint el, const gchar *str, ...) +col_add_lstr(column_info *cinfo, const gint el, const gchar *str1, ...) { va_list ap; int i; gsize pos; gsize max_len; + const gchar *str; if (!CHECK_COL(cinfo, el)) return; @@ -640,7 +643,8 @@ col_add_lstr(column_info *cinfo, const gint el, const gchar *str, ...) cinfo->col_data[i] = cinfo->col_buf[i]; } - va_start(ap, str); + va_start(ap, str1); + str = str1; do { if G_UNLIKELY(str == NULL) str = "(null)"; |