Fixed bug in get_length_upper_bound where g_print-ing a NULL string would cause a segfault
This commit is contained in:
@ -322,6 +322,7 @@ get_length_upper_bound (gchar* fmt, va_list *args)
|
|||||||
int short_int;
|
int short_int;
|
||||||
int long_int;
|
int long_int;
|
||||||
int done;
|
int done;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
while (*fmt)
|
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. */
|
/* I ignore 'q' and 'L', they're not portable anyway. */
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
len += strlen (va_arg (*args, char *));
|
tmp = va_arg(*args, char *);
|
||||||
|
if(tmp)
|
||||||
|
len += strlen (tmp);
|
||||||
|
else
|
||||||
|
len += strlen ("(null)");
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
|
|||||||
Reference in New Issue
Block a user