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>
This commit is contained in:
parent
18fabb4733
commit
b98c570969
|
@ -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)";
|
||||
|
|
Loading…
Reference in New Issue