Skip to content

Commit 0b3ab3a

Browse files
committed
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 #3043
1 parent 0e7c7a9 commit 0b3ab3a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libvips/iofuncs/buf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ vips_buf_appendns( VipsBuf *buf, const char *str, int sz )
262262

263263
if( buf->full )
264264
return( FALSE );
265+
if( !str )
266+
return( TRUE );
265267

266268
/* Amount we want to copy.
267269
*/
@@ -528,7 +530,7 @@ vips_buf_appendgv( VipsBuf *buf, GValue *value )
528530
* handled by boxed, see below.
529531
*/
530532
str = g_value_get_string( value );
531-
result = vips_buf_appends( buf, str );
533+
result = vips_buf_appends( buf, str );
532534
handled = TRUE;
533535
}
534536
break;

0 commit comments

Comments
 (0)