fix string truncation regression
buf_append was dropping the final byte
This commit is contained in:
parent
01a5bfa27e
commit
2b70333d7e
|
@ -275,11 +275,12 @@ vips_buf_appendns( VipsBuf *buf, const char *str, int sz )
|
||||||
*/
|
*/
|
||||||
avail = buf->mx - buf->i - 4;
|
avail = buf->mx - buf->i - 4;
|
||||||
|
|
||||||
/* Amount we actually copy.
|
|
||||||
*/
|
|
||||||
cpy = VIPS_MIN( n, avail );
|
cpy = VIPS_MIN( n, avail );
|
||||||
|
|
||||||
vips_strncpy( buf->base + buf->i, str, cpy );
|
/* Can't use vips_strncpy() here, we don't want to drop the end of the
|
||||||
|
* string.
|
||||||
|
*/
|
||||||
|
strncpy( buf->base + buf->i, str, cpy );
|
||||||
buf->i += cpy;
|
buf->i += cpy;
|
||||||
|
|
||||||
if( buf->i >= buf->mx - 4 ) {
|
if( buf->i >= buf->mx - 4 ) {
|
||||||
|
|
Loading…
Reference in New Issue