Bug and Fix - Follow Up
jra at dp.samba.org
jra at dp.samba.org
Thu Dec 19 18:55:01 GMT 2002
On Tue, Dec 17, 2002 at 09:01:16PM -0600, Matt Roberts, GRDA wrote:
>
> In my search for the cause of the behavior seen in my earlier post,
> I traced the function call path to these two interesting functions,
> int source/lib/util.c at about line 133:
>
> BOOL set_global_scope(const char *scope)
> {
> SAFE_FREE(smb_scope);
> smb_scope = strdup(scope);
> if (!smb_scope)
> return False;
> strupper(smb_scope);
> return True;
> }
>
> const char *global_scope(void)
> {
> return smb_scope;
> }
>
>
> Since the latter function returns the string 'smb_scope', regardless
> of what is in it, wouldn't the first function protect against being
> set to a NULL value by rewriting it similar to this?
>
> BOOL set_global_scope(const char *scope)
> {
> SAFE_FREE(smb_scope);
>
> if (!smb_scope) {
> smb_scope = strdup("");
> return False;
> }
>
> smb_scope = strdup(scope);
> strupper(smb_scope);
> return True;
> }
Already committed - thanks !
Jeremy.
More information about the samba-technical
mailing list