undo: fix off-by-one when prepending to inline string

This fixes the conditional in istring_prepend() to match other uses,
notably to match istring_append().

Fixes #6684
This commit is contained in:
Christian Hergert
2024-05-01 11:28:55 -07:00
committed by Matthias Clasen
parent 957ff91fa5
commit 4d8bb515fb

View File

@@ -117,7 +117,7 @@ static inline void
istring_prepend (IString *str,
IString *other)
{
if G_LIKELY (str->n_bytes + other->n_bytes < sizeof str->u.buf - 1)
if G_LIKELY (str->n_bytes + other->n_bytes <= (sizeof str->u.buf - 1))
{
memmove (str->u.buf + other->n_bytes, str->u.buf, str->n_bytes);
memcpy (str->u.buf, other->u.buf, other->n_bytes);