mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 07:36:17 +01:00
Bug 167569 - g_string_append_printf crashes on win32 when used with a NULL
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. svn path=/trunk/; revision=7917
This commit is contained in:
parent
b89e432e8d
commit
56f54c0ebc
@ -1,3 +1,11 @@
|
||||
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):
|
||||
|
@ -574,11 +574,15 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
|
||||
# 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':
|
||||
@ -948,14 +952,18 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
|
||||
#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;
|
||||
|
Loading…
Reference in New Issue
Block a user