From 32ee9767088fcd395e1f1a22d781d33b076aa78b Mon Sep 17 00:00:00 2001 From: Aravind Srinivasan Date: Wed, 23 Sep 2009 20:37:04 +0000 Subject: vfs catia: Fix a NULL dereference when CATIA is loaded with no mappings specified. When we use the CATIA vfs module and don't have any mapping specified, we return NULL for the mapped_name, thereby resulting in segfaults. When we don't have catia mapping, we should just use the old name instead of returning NULL for the mapped_name. Signed-off-by: Tim Prouty --- source3/modules/vfs_catia.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 2631060441..14e404f9f5 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -224,8 +224,15 @@ static NTSTATUS catia_string_replace_allocate(connection_struct *conn, size_t converted_size; TALLOC_CTX *ctx = talloc_tos(); - if (!init_mappings(conn, &selected)) + if (!init_mappings(conn, &selected)) { + /* No mappings found. Just use the old name */ + *mapped_name = talloc_strdup(NULL, name_in); + if (!*mapped_name) { + errno = ENOMEM; + return NT_STATUS_NO_MEMORY; + } return NT_STATUS_OK; + } if ((push_ucs2_talloc(ctx, &tmpbuf, name_in, &converted_size)) == -1) { -- cgit