From 4d8bb515fbe1f4fd0804f0646a4e4fdbd30f546c Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 1 May 2024 11:28:55 -0700 Subject: [PATCH] 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 --- gtk/gtkistringprivate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkistringprivate.h b/gtk/gtkistringprivate.h index 9d5045316a..473888b3c3 100644 --- a/gtk/gtkistringprivate.h +++ b/gtk/gtkistringprivate.h @@ -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);