From: Michael Adam Date: Wed, 18 Jun 2008 12:50:53 +0000 (+0200) Subject: Fix Bug #5548 (segfauls in handle_include with %m macro expansion). X-Git-Tag: samba-3.3.0pre1~856 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c65b456c6a145d15b7fd27a2a3440a0709fc3277;p=thirdparty%2Fsamba.git Fix Bug #5548 (segfauls in handle_include with %m macro expansion). In alloc_sub_basic, when expanding '%m', substitute "" instead of NULL for remote_machine when this is NULL. Else a NULL string is returned. Michael --- diff --git a/source/lib/substitute.c b/source/lib/substitute.c index 17bcbcac9d8..926bb8233d7 100644 --- a/source/lib/substitute.c +++ b/source/lib/substitute.c @@ -655,7 +655,10 @@ char *alloc_sub_basic(const char *smb_name, const char *domain_name, a_string = realloc_string_sub(a_string, "%h", myhostname()); break; case 'm' : - a_string = realloc_string_sub(a_string, "%m", remote_machine); + a_string = realloc_string_sub(a_string, "%m", + remote_machine + ? remote_machine + : ""); break; case 'v' : a_string = realloc_string_sub(a_string, "%v", SAMBA_VERSION_STRING);