bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] userspec: avoid undefined behavior in gettext call


From: Pádraig Brady
Subject: [PATCH] userspec: avoid undefined behavior in gettext call
Date: Wed, 24 Jun 2015 17:58:41 +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      | 8 ++++++++
 lib/userspec.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 051e06f..1a8d095 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-06-24  Pádraig Brady  <address@hidden>
+
+       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  <address@hidden>
 
        gitlog-to-changelog: improve gitmerge.el commits
diff --git a/lib/userspec.c b/lib/userspec.c
index 2bd0926..84632c3 100644
--- a/lib/userspec.c
+++ b/lib/userspec.c
@@ -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]",
-- 
2.4.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]