aboutsummaryrefslogtreecommitdiffstats
path: root/gettext.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2023-03-14 21:32:42 +0100
committerJohannes Schindelin <johannes.schindelin@gmx.de>2023-04-17 21:15:42 +0200
commit4fe5d0b10afdc9ac5b703605b8d84d1ce5d71e87 (patch)
tree2ceba17720cfc0762eb042ada63bba82fa4072f5 /gettext.c
parent18e2b1cfc80990719275d7b08e6e50f3e8cbc902 (diff)
parentc4137be0f5a6edf9a9044e6e43ecf4468c7a4046 (diff)
downloadgit-4fe5d0b10afdc9ac5b703605b8d84d1ce5d71e87.tar.gz
Merge branch 'avoid-using-uninitialized-gettext'
Avoids the overhead of calling `gettext` when initialization of the translated messages was skipped. Addresses CVE-2023-25815. * avoid-using-uninitialized-gettext: (1 commit) gettext: avoid using gettext if the locale dir is not present
Diffstat (limited to 'gettext.c')
-rw-r--r--gettext.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gettext.c b/gettext.c
index 1b564216d0..610d402fe7 100644
--- a/gettext.c
+++ b/gettext.c
@@ -109,6 +109,8 @@ static void init_gettext_charset(const char *domain)
setlocale(LC_CTYPE, "C");
}
+int git_gettext_enabled = 0;
+
void git_setup_gettext(void)
{
const char *podir = getenv(GIT_TEXT_DOMAIN_DIR_ENVIRONMENT);
@@ -130,6 +132,8 @@ void git_setup_gettext(void)
init_gettext_charset("git");
textdomain("git");
+ git_gettext_enabled = 1;
+
free(p);
}