diff --git a/glib/ggettext.c b/glib/ggettext.c index 21933d962..78b8e6487 100644 --- a/glib/ggettext.c +++ b/glib/ggettext.c @@ -237,6 +237,10 @@ g_dpgettext (const gchar *domain, translation = g_dgettext (domain, tmp); + /* g_dgettext() may return the value we pass to it, which will be on + * this stack frame since we allocated it with g_alloca(). If so, we + * return a pointer into our original input instead. + */ if (translation == tmp) return sep + 1; } @@ -294,6 +298,10 @@ g_dpgettext2 (const gchar *domain, msg_ctxt_id[msgctxt_len - 1] = '|'; translation = g_dgettext (domain, msg_ctxt_id); + /* g_dgettext() may return the value we pass to it, which will be on this + * stack frame since we allocated it with g_alloca(). If so, we return our + * original input instead. + */ if (translation == msg_ctxt_id) return msgid; }