diff options
author | Luke Leighton <lkcl@samba.org> | 1999-07-14 18:16:57 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-07-14 18:16:57 +0000 |
commit | c553c01c86bca04583277f65d45d0e097fa38603 (patch) | |
tree | c12deab54b141f345a70bc68c1b27456cf1afa06 | |
parent | 0ad513f42c10266bf4ab61089eb212efd05366f6 (diff) | |
download | samba-c553c01c86bca04583277f65d45d0e097fa38603.tar.gz samba-c553c01c86bca04583277f65d45d0e097fa38603.tar.bz2 samba-c553c01c86bca04583277f65d45d0e097fa38603.zip |
removed strncpy()
(This used to be commit 4bdff2748956a61f12a92e19a9af98c7b9668e8f)
-rw-r--r-- | source3/smbd/dfs.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/source3/smbd/dfs.c b/source3/smbd/dfs.c index 0c1b3db4c4..baae960538 100644 --- a/source3/smbd/dfs.c +++ b/source3/smbd/dfs.c @@ -62,47 +62,49 @@ mangle the localpath and store it. static void mangle_dfs_path(dfs_internal_table *buf) { char *p; - char *s; + char *mp; char *q; - int i; + int mlen; fstring temp; - p=buf->localpath; - s=buf->mangledpath; + p = buf->localpath; + mp =buf->mangledpath; + mlen = sizeof(buf->mangledpath); - ZERO_STRUCTP(s); - DEBUG(0, ("DFS name is:[%s]\n", buf->localpath)); + ZERO_STRUCTP(mp); + DEBUG(2, ("DFS name is: [%s]\n", buf->localpath)); /* copy the head: \server-name\ */ - q=strchr(p+1, '\\'); - strncpy(s, p, q-p+1); - p=q+1; + q = strchr(p + 1, '\\'); + safe_strcpy(mp, p, mlen); + p = q + 1; - while (q!=NULL) + while (q != NULL) { - q=strchr(p, '\\'); - if (q!=NULL) - i=PTR_DIFF(q,p); - else - i=strlen(p); + q = strchr(p, '\\'); - strncpy(temp, p, i); + safe_strcpy(temp, p, sizeof(temp)); if (!is_8_3(temp, True)) + { mangle_name_83(temp); + } - strncat(s, temp, i); - if (q!=NULL) - strncat(s, "\\", 1); - p=q+1; + safe_strcat(mp, temp, mlen); + + if (q != NULL) + { + safe_strcat(mp, "\\", mlen); + } + p = q + 1; } /* - strupper(buf->mangledpath); + strupper(mp); */ - buf->mangledpath_length=strlen(buf->mangledpath); - DEBUGADD(0, ("DFS mangled name is: [%s]\n", buf->mangledpath)); + buf->mangledpath_length = strlen(mp); + DEBUGADD(2, ("DFS mangled name is: [%s]\n", mp)); } /**************************************************************************** |