gift.patch 893 B

1234567891011121314151617181920212223242526272829
  1. Index: lib/strobj.c
  2. --- lib/strobj.c.orig 2003-12-23 05:22:53.000000000 +0100
  3. +++ lib/strobj.c 2004-05-21 09:44:36.000000000 +0200
  4. @@ -165,6 +165,7 @@
  5. int string_appendvf (String *sobj, const char *fmt, va_list args)
  6. {
  7. + va_list args_cpy;
  8. int written = 0;
  9. if (!sobj)
  10. @@ -186,7 +187,15 @@
  11. {
  12. max = sobj->alloc - sobj->len;
  13. - written = vsnprintf (sobj->str + sobj->len, max, fmt, args);
  14. + /*
  15. + * We have to make a copy of the va_list because we may pass this
  16. + * point multiple times. Note that simply calling va_start again is
  17. + * not a good idea since the va_start/va_end should be in the same
  18. + * stack frame because of some obscure implementations.
  19. + */
  20. + va_copy (args_cpy, args);
  21. + written = vsnprintf (sobj->str + sobj->len, max, fmt, args_cpy);
  22. + va_end (args_cpy);
  23. /*
  24. * Some implementations use -1 to indicate an inability to write