summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-02-10 09:20:09 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-02-10 09:20:09 +0000
commitc46f8a0249b7e5b2ef55b2d01ee5e23d103d4c23 (patch)
treef1b5e6ba2f0fe65df1d81e8f58d06a90758f7bfc /source3/locking
parenta9d598d6bbef39e2a2022befded7e5c5e1483f98 (diff)
downloadsamba-c46f8a0249b7e5b2ef55b2d01ee5e23d103d4c23.tar.gz
samba-c46f8a0249b7e5b2ef55b2d01ee5e23d103d4c23.tar.bz2
samba-c46f8a0249b7e5b2ef55b2d01ee5e23d103d4c23.zip
Use safe_strcpy() instead of pstrcpy() for malloced strings.
Andrew Bartlett (This used to be commit 333d313c9d047697d7a8a519fdbc2b7da06745c2)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index e5a72d2208..d4794560f6 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -611,6 +611,7 @@ BOOL set_share_mode(files_struct *fsp, uint16 port, uint16 op_type)
/* read in the existing share modes if any */
dbuf = tdb_fetch(tdb, locking_key_fsp(fsp));
if (!dbuf.dptr) {
+ size_t offset;
/* we'll need to create a new record */
pstring fname;
@@ -628,7 +629,8 @@ BOOL set_share_mode(files_struct *fsp, uint16 port, uint16 op_type)
DEBUG(10,("set_share_mode: creating entry for file %s. num_share_modes = 1\n",
fsp->fsp_name ));
- pstrcpy(p + sizeof(*data) + sizeof(share_mode_entry), fname);
+ offset = sizeof(*data) + sizeof(share_mode_entry);
+ safe_strcpy(p + offset, fname, size - offset);
fill_share_mode(p + sizeof(*data), fsp, port, op_type);
dbuf.dptr = p;
dbuf.dsize = size;