fix null string in buffer print

Some libvips header fields can be NULL, for example filename, and we
need to avoid null pointer deref on print.

See https://github.com/libvips/libvips/issues/3043
This commit is contained in:
John Cupitt 2022-09-11 14:26:53 +01:00
parent 0e7c7a9a13
commit 0b3ab3a934

View File

@ -262,6 +262,8 @@ vips_buf_appendns( VipsBuf *buf, const char *str, int sz )
if( buf->full )
return( FALSE );
if( !str )
return( TRUE );
/* Amount we want to copy.
*/
@ -528,7 +530,7 @@ vips_buf_appendgv( VipsBuf *buf, GValue *value )
* handled by boxed, see below.
*/
str = g_value_get_string( value );
result = vips_buf_appends( buf, str );
result = vips_buf_appends( buf, str );
handled = TRUE;
}
break;