about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-01-02 16:46:12 +0100
committerFlorian Weimer <fweimer@redhat.com>2019-01-02 17:11:31 +0100
commit766e8fb932079e96fd02d92a3a1121dff3a73637 (patch)
treeccd3db94bb2e0655cfae47c84d216d2ec53d623a
parent3981fc3453641368d2edbe480e7089dc9abf6555 (diff)
downloadglibc-766e8fb932079e96fd02d92a3a1121dff3a73637.tar.gz
glibc-766e8fb932079e96fd02d92a3a1121dff3a73637.tar.xz
glibc-766e8fb932079e96fd02d92a3a1121dff3a73637.zip
intl: Do not return NULL on asprintf failure in gettext [BZ #24018]
Fixes commit 9695dd0c9309712ed8e9c17a7040fe7af347f2dc ("DCIGETTEXT:
Use getcwd, asprintf to construct absolute pathname").

(cherry picked from commit 8c1aafc1f34d090a5b41dc527c33e8687f6a1287)
-rw-r--r--ChangeLog6
-rw-r--r--NEWS1
-rw-r--r--intl/dcigettext.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ad904a4223..181bd437be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-02  Florian Weimer  <fweimer@redhat.com>
+
+	[BZ #24018]
+	* intl/dcigettext.c (DCIGETTEXT): Do not return NULL on asprintf
+	failure.
+
 2018-12-31  Florian Weimer  <fw@deneb.enyo.de>
 
 	[BZ #24027]
diff --git a/NEWS b/NEWS
index c5ccff2442..a787bf619e 100644
--- a/NEWS
+++ b/NEWS
@@ -104,6 +104,7 @@ The following bugs are resolved with this release:
   [23821] si_band in siginfo_t has wrong type long int on sparc64
   [23822] ia64 static libm.a is missing exp2f, log2f and powf symbols
   [23927] Linux if_nametoindex() does not close descriptor (CVE-2018-19591)
+  [24018] gettext may return NULL
   [24027] malloc: Integer overflow in realloc
 
 
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index 2a50369948..25f47c5bd3 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -631,7 +631,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
 	  int ret = __asprintf (&xdirname, "%s/%s", cwd, dirname);
 	  free (cwd);
 	  if (ret < 0)
-	      return NULL;
+	    goto return_untranslated;
 	  dirname = xdirname;
 	}
 #ifndef IN_LIBGLOCALE