]> Savannah Git Hosting - gnulib.git/commitdiff
userspec: avoid undefined behavior in gettext call
authorPádraig Brady <P@draigBrady.com>
Wed, 24 Jun 2015 16:54:16 +0000 (17:54 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 25 Jun 2015 01:35:59 +0000 (02:35 +0100)
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()

ChangeLog
lib/userspec.c

index 051e06f99310b3e83fc3f5bf7bdcd238b676f532..1a8d095cf3acefb1fa1771510d34904fb1eabbfc 100644 (file)
--- 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
index 2bd092654a4c52883ace0b8dfe50dae89771861b..84632c37c5050a7f04041ec0a594bcd540683182 100644 (file)
@@ -234,7 +234,7 @@ parse_with_separator (char const *spec, char const *separator,
 
   free (u);
   free (gname);
-  return _(error_msg);
+  return error_msg ? _(error_msg) : NULL;
 }
 
 /* Extract from SPEC, which has the form "[user][:.][group]",