[gimp] app/dialogs: protect against calling gettext(NULL).
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app/dialogs: protect against calling gettext(NULL).
- Date: Mon, 21 Dec 2020 20:17:01 +0000 (UTC)
commit aa151a08a06d0a65ae0ba19fcb24f30571004eb3
Author: Érico Rolim <erico erc gmail com>
Date: Fri Dec 11 23:13:32 2020 -0300
app/dialogs: protect against calling gettext(NULL).
In gimp_dialog_factory_register_entry(), strings were passed to gettext
without checking for a NULL pointer. The gettext documentation [1]
points out that that's undefined behavior, and musl libc's
implementation of gettext segfaults in that case.
[1] https://www.gnu.org/software/gettext/manual/gettext.html#Interface-to-gettext
app/dialogs/dialogs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c
index 32eaf081fd..730e777928 100644
--- a/app/dialogs/dialogs.c
+++ b/app/dialogs/dialogs.c
@@ -538,8 +538,8 @@ dialogs_init (Gimp *gimp,
for (i = 0; i < G_N_ELEMENTS (entries); i++)
gimp_dialog_factory_register_entry (factory,
entries[i].identifier,
- gettext (entries[i].name),
- gettext (entries[i].blurb),
+ entries[i].name ? gettext(entries[i].name) : NULL,
+ entries[i].blurb ? gettext(entries[i].blurb) : NULL,
entries[i].icon_name,
entries[i].help_id,
entries[i].new_func,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]