From 402f350d06c3d307909acbec0f728ca6cfd3d1c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Wed, 24 Jun 2015 17:54:16 +0100 Subject: [PATCH] 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() --- ChangeLog | 8 ++++++++ lib/userspec.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 051e06f993..1a8d095cf3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-06-24 Pádraig Brady + + 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 gitlog-to-changelog: improve gitmerge.el commits diff --git a/lib/userspec.c b/lib/userspec.c index 2bd092654a..84632c37c5 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.39.5