1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-20 14:03:59 +03:00

Use safe_strcpy() instead of pstrcpy() for malloced strings.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett -
parent 79650e08c9
commit 333d313c9d

View File

@ -611,6 +611,7 @@ BOOL set_share_mode(files_struct *fsp, uint16 port, uint16 op_type)
/* read in the existing share modes if any */ /* read in the existing share modes if any */
dbuf = tdb_fetch(tdb, locking_key_fsp(fsp)); dbuf = tdb_fetch(tdb, locking_key_fsp(fsp));
if (!dbuf.dptr) { if (!dbuf.dptr) {
size_t offset;
/* we'll need to create a new record */ /* we'll need to create a new record */
pstring fname; 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", DEBUG(10,("set_share_mode: creating entry for file %s. num_share_modes = 1\n",
fsp->fsp_name )); 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); fill_share_mode(p + sizeof(*data), fsp, port, op_type);
dbuf.dptr = p; dbuf.dptr = p;
dbuf.dsize = size; dbuf.dsize = size;