+2009-02-27 Tor Lillqvist <tml@novell.com>
+
+ Bug 167569 - g_string_append_printf crashes on win32 when used
+ with a NULL argument
+
+ * glib/gnulib/vasnprintf.c (vasnprintf): Add workaround for buggy
+ programs. Patch by Owen.
+
2009-02-23 Paolo Borelli <pborelli@katamail.com>
* glib/gutf8.c (_g_utf8_make_valid):
# ifdef HAVE_WCHAR_T
if (type == TYPE_WIDE_STRING)
tmp_length =
- local_wcslen (a.arg[dp->arg_index].a.a_wide_string)
+ (a.arg[dp->arg_index].a.a_wide_string == NULL
+ ? 6 /* wcslen(L"(null)") */
+ : local_wcslen (a.arg[dp->arg_index].a.a_wide_string))
* MB_CUR_MAX;
else
# endif
- tmp_length = strlen (a.arg[dp->arg_index].a.a_string);
+ tmp_length = a.arg[dp->arg_index].a.a_string == NULL
+ ? 6 /* strlen("(null)") */
+ : strlen (a.arg[dp->arg_index].a.a_string);
break;
case 'p':
#endif
case TYPE_STRING:
{
- const char *arg = a.arg[dp->arg_index].a.a_string;
+ const char *arg = a.arg[dp->arg_index].a.a_string == NULL
+ ? "(null)"
+ : a.arg[dp->arg_index].a.a_string;
SNPRINTF_BUF (arg);
}
break;
#ifdef HAVE_WCHAR_T
case TYPE_WIDE_STRING:
{
- const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
+ const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string == NULL
+ ? L"(null)"
+ : a.arg[dp->arg_index].a.a_wide_string;
SNPRINTF_BUF (arg);
}
break;