From 74a07edb505c9f20a93c00da06cb5c997b6b3c8a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 16 Apr 2007 19:10:16 +0000 Subject: r22266: Fix bug #4512 - we were returning a volume label greater than 32 unicode chars. Windows XP doesn't like that :-). Jeremy (This used to be commit e59b5276b56d6963ddd0598bbd1b15426d2d13e8) --- source3/param/loadparm.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'source3/param/loadparm.c') diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index a049b2d47a..ea434e4768 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -5299,15 +5299,22 @@ struct share_params *snum2params_static(int snum) A useful volume label function. ********************************************************************/ -char *volume_label(int snum) +const char *volume_label(int snum) { - char *ret = lp_volume(snum); - if (!*ret) - return lp_servicename(snum); - return (ret); + char *ret; + const char *label = lp_volume(snum); + if (!*label) { + label = lp_servicename(snum); + } + + /* This returns a 33 byte guarenteed null terminated string. */ + ret = talloc_strndup(main_loop_talloc_get(), label, 32); + if (!ret) { + return ""; + } + return ret; } - /******************************************************************* Set the server type we will announce as via nmbd. ********************************************************************/ -- cgit