Fix varargs handling in col_{add,append}_lstr().
authorGuy Harris <guy@alum.mit.edu>
Fri, 5 Dec 2014 21:04:59 +0000 (13:04 -0800)
committerGuy Harris <guy@alum.mit.edu>
Fri, 5 Dec 2014 21:05:51 +0000 (21:05 +0000)
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>
epan/column-utils.c

index 0de9a7c9146b13e086cbfbcd977bf2ad549aefee..44b855fb231803b18bd3bb5528b350853ac8915c 100644 (file)
@@ -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)";