working on bug 687; protect against null src strings in alloc_sub_basic()
authorGerald Carter <jerry@samba.org>
Mon, 8 Dec 2003 17:42:26 +0000 (17:42 +0000)
committerGerald Carter <jerry@samba.org>
Mon, 8 Dec 2003 17:42:26 +0000 (17:42 +0000)
source/lib/substitute.c

index ee342964d0ff9f1475c78f6834bac4fdcb7cde30..5dec9808101d957d7340364367183f68167e177b 100644 (file)
@@ -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"));