summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-12-08 17:40:44 +0000
committerGerald Carter <jerry@samba.org>2003-12-08 17:40:44 +0000
commitf141ad1a96453d3fc5fe5e99685b44ffc2e6cc7a (patch)
treeecb3d3b2dfe252042556979d9fbcdd6b1ee2d87e
parent67db65abf1a565c75a699297702e78cbc10dbe70 (diff)
downloadsamba-f141ad1a96453d3fc5fe5e99685b44ffc2e6cc7a.tar.gz
samba-f141ad1a96453d3fc5fe5e99685b44ffc2e6cc7a.tar.xz
samba-f141ad1a96453d3fc5fe5e99685b44ffc2e6cc7a.zip
working on bug 687; protect against null src strings in alloc_sub_basic()
(This used to be commit 6cf91bce40f85879de00b9ce89ad9b5e04a50b35)
-rw-r--r--source3/lib/substitute.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index ee342964d0..5dec980810 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -494,6 +494,13 @@ char *alloc_sub_basic(const char *smb_name, const char *str)
struct passwd *pass;
const char *local_machine_name = get_local_machine_name();
+ /* workaround to prevent a crash while lookinf at bug #687 */
+
+ if ( !str ) {
+ DEBUG(0,("alloc_sub_basic: NULL source string! This should not happen\n"));
+ return NULL;
+ }
+
a_string = strdup(str);
if (a_string == NULL) {
DEBUG(0, ("alloc_sub_specified: Out of memory!\n"));