diff options
author | Elliot Lee <sopwith@src.gnome.org> | 1998-01-01 22:48:18 +0000 |
---|---|---|
committer | Elliot Lee <sopwith@src.gnome.org> | 1998-01-01 22:48:18 +0000 |
commit | f7443e0e854a59b5a97ef4bf7554da2db0f567b1 (patch) | |
tree | c8d94a1ed5ffc752b3d76700e1ed1a8c4673bd68 /glib | |
parent | e2f5eb1c3e6bdd4e687d286414e03c341b6c4335 (diff) | |
download | gtk+-f7443e0e854a59b5a97ef4bf7554da2db0f567b1.tar.gz |
Fixed bug in get_length_upper_bound where g_print-ing a NULL string would cause a segfault
Diffstat (limited to 'glib')
-rw-r--r-- | glib/gstring.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/glib/gstring.c b/glib/gstring.c index eaadefd0eb..b803f67e51 100644 --- a/glib/gstring.c +++ b/glib/gstring.c @@ -322,6 +322,7 @@ get_length_upper_bound (gchar* fmt, va_list *args) int short_int; int long_int; int done; + char *tmp; while (*fmt) { @@ -362,7 +363,11 @@ get_length_upper_bound (gchar* fmt, va_list *args) /* I ignore 'q' and 'L', they're not portable anyway. */ case 's': - len += strlen (va_arg (*args, char *)); + tmp = va_arg(*args, char *); + if(tmp) + len += strlen (tmp); + else + len += strlen ("(null)"); done = TRUE; break; case 'd': |