summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-12-08 17:42:26 +0000
committerGerald Carter <jerry@samba.org>2003-12-08 17:42:26 +0000
commitb187511920dc6245faeb5ea6b48132bd5ba69ef9 (patch)
treedaa002b66cee51e2100f882c6afe3886e2a39bae
parentf891d434a1406d18f9842ac6b3d1ea49ee96b9bc (diff)
downloadsamba-b187511920dc6245faeb5ea6b48132bd5ba69ef9.tar.gz
working on bug 687; protect against null src strings in alloc_sub_basic()
-rw-r--r--source/lib/substitute.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/lib/substitute.c b/source/lib/substitute.c
index ee342964d0f..5dec9808101 100644
--- a/source/lib/substitute.c
+++ b/source/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"));