changeset 18024:7bef0e656365

userspec: avoid undefined behavior in gettext call GCC 5.1.1 -fsanitize=undefined with glibc 2.21 is returning: "runtime error: null pointer passed as argument 2, which is declared to never be null" * lib/userspec.c (parse_with_separator): Avoid passing NULL to gettext()
author Pádraig Brady <P@draigBrady.com>
date Wed, 24 Jun 2015 17:54:16 +0100
parents 73a45157f553
children 5201cc72e203
files ChangeLog lib/userspec.c
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-06-24  Pádraig Brady  <P@draigBrady.com>
+
+	userspec: avoid undefined behavior in gettext call
+	GCC 5.1.1 -fsanitize=undefined with glibc 2.21 is returning:
+	"runtime error: null pointer passed as argument 2,
+	 which is declared to never be null"
+	* lib/userspec.c (parse_with_separator): Avoid passing NULL to gettext()
+
 2015-06-20  Glenn Morris  <rgm@gnu.org>
 
 	gitlog-to-changelog: improve gitmerge.el commits
--- a/lib/userspec.c
+++ b/lib/userspec.c
@@ -234,7 +234,7 @@
 
   free (u);
   free (gname);
-  return _(error_msg);
+  return error_msg ? _(error_msg) : NULL;
 }
 
 /* Extract from SPEC, which has the form "[user][:.][group]",