summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-05-03 14:01:20 -0700
committerJeremy Allison <jra@samba.org>2011-05-04 12:12:14 -0700
commite4667926ce752775e9ba1108c4cb41d6f97a04fa (patch)
treeecd00fbd93985bdbe6871bec5e6a2ad76a1cda92
parent18582016d96e3f41f8828f0539969678ad7d233e (diff)
downloadsamba-e4667926ce752775e9ba1108c4cb41d6f97a04fa.tar.gz
samba-e4667926ce752775e9ba1108c4cb41d6f97a04fa.tar.bz2
samba-e4667926ce752775e9ba1108c4cb41d6f97a04fa.zip
Fix the only place we reply on the NULL handling for the source in safe_strcpy.
-rw-r--r--source3/locking/locking.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 232a8c3702..1f63bdd4c4 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -838,14 +838,17 @@ static TDB_DATA unparse_share_modes(const struct share_mode_lock *lck)
offset += token_size;
}
- safe_strcpy((char *)result.dptr + offset, lck->servicepath,
- result.dsize - offset - 1);
+ strlcpy((char *)result.dptr + offset,
+ lck->servicepath ? lck->servicepath : "",
+ result.dsize - offset);
offset += sp_len + 1;
- safe_strcpy((char *)result.dptr + offset, lck->base_name,
- result.dsize - offset - 1);
+ strlcpy((char *)result.dptr + offset,
+ lck->base_name ? lck->base_name : "",
+ result.dsize - offset);
offset += bn_len + 1;
- safe_strcpy((char *)result.dptr + offset, lck->stream_name,
- result.dsize - offset - 1);
+ strlcpy((char *)result.dptr + offset,
+ lck->stream_name ? lck->stream_name : "",
+ result.dsize - offset);
if (DEBUGLEVEL >= 10) {
print_share_mode_table(data);
@@ -1087,10 +1090,15 @@ bool rename_share_filename(struct messaging_context *msg_ctx,
DEBUG(10,("rename_share_filename: msg_len = %u\n", (unsigned int)msg_len ));
- safe_strcpy(&frm[24], lck->servicepath, sp_len);
- safe_strcpy(&frm[24 + sp_len + 1], lck->base_name, bn_len);
- safe_strcpy(&frm[24 + sp_len + 1 + bn_len + 1], lck->stream_name,
- sn_len);
+ strlcpy(&frm[24],
+ lck->servicepath ? lck->servicepath : "",
+ sp_len+1);
+ strlcpy(&frm[24 + sp_len + 1],
+ lck->base_name ? lck->base_name : "",
+ bn_len+1);
+ strlcpy(&frm[24 + sp_len + 1 + bn_len + 1],
+ lck->stream_name ? lck->stream_name : "",
+ sn_len+1);
/* Send the messages. */
for (i=0; i<lck->num_share_modes; i++) {