alpha_strcpy includes the space for the terminating nul.
authorJeremy Allison <jra@samba.org>
Thu, 15 Nov 2007 21:18:42 +0000 (13:18 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 15 Nov 2007 21:18:42 +0000 (13:18 -0800)
Jeremy.
(This used to be commit b3ed3f7e4e40c4f78d4c347411c75de81979455f)

source3/lib/substitute.c

index ce88a78e776d900551c2dca966a335d788ce55a3..db79a9f2b5cbb9f53cc301cf46e3e554971e8785 100644 (file)
@@ -72,8 +72,9 @@ bool set_local_machine_name(const char *local_name, bool perm)
                SAFE_FREE(tmp_local_machine);
                return false;
        }
+       /* alpha_strcpy includes the space for the terminating nul. */
        alpha_strcpy(local_machine,tmp_local_machine,
-                       SAFE_NETBIOS_CHARS,len);
+                       SAFE_NETBIOS_CHARS,len+1);
        strlower_m(local_machine);
        SAFE_FREE(tmp_local_machine);
 
@@ -123,8 +124,9 @@ bool set_remote_machine_name(const char *remote_name, bool perm)
                return false;
        }
 
+       /* alpha_strcpy includes the space for the terminating nul. */
        alpha_strcpy(remote_machine,tmp_remote_machine,
-                       SAFE_NETBIOS_CHARS,len);
+                       SAFE_NETBIOS_CHARS,len+1);
        strlower_m(remote_machine);
        SAFE_FREE(tmp_remote_machine);
 
@@ -185,9 +187,10 @@ void sub_set_smb_name(const char *name)
                return;
        }
 
+       /* alpha_strcpy includes the space for the terminating nul. */
        alpha_strcpy(smb_user_name, tmp,
                        SAFE_NETBIOS_CHARS,
-                       len);
+                       len+1);
 
        SAFE_FREE(tmp);