mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
Change safe_strcpy_base to strlcpy_base. Note the size doesn't change here as the original macro auto-added the -1.
This commit is contained in:
parent
017e0c8d95
commit
0c464df22b
@ -41,8 +41,8 @@ size_t __unsafe_string_function_usage_here_size_t__(void);
|
||||
|
||||
#endif /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */
|
||||
|
||||
#define safe_strcpy_base(dest, src, base, size) \
|
||||
safe_strcpy(dest, src, size-PTR_DIFF(dest,base)-1)
|
||||
#define strlcpy_base(dest, src, base, size) \
|
||||
strlcpy(dest, src, size-PTR_DIFF(dest,base))
|
||||
|
||||
/* String copy functions - macro hell below adds 'type checking' (limited,
|
||||
but the best we can do in C) */
|
||||
|
@ -702,7 +702,7 @@ static void add_to_do_list_queue(const char *entry)
|
||||
}
|
||||
}
|
||||
if (do_list_queue) {
|
||||
safe_strcpy_base(do_list_queue + do_list_queue_end,
|
||||
strlcpy_base(do_list_queue + do_list_queue_end,
|
||||
entry, do_list_queue, do_list_queue_size);
|
||||
do_list_queue_end = new_end;
|
||||
DEBUG(4,("added %s to do_list_queue (start=%d, end=%d)\n",
|
||||
|
@ -65,16 +65,16 @@ int cli_print_queue(struct cli_state *cli,
|
||||
p = param;
|
||||
SSVAL(p,0,76); /* API function number 76 (DosPrintJobEnum) */
|
||||
p += 2;
|
||||
safe_strcpy_base(p,"zWrLeh", param, sizeof(param)); /* parameter description? */
|
||||
strlcpy_base(p,"zWrLeh", param, sizeof(param)); /* parameter description? */
|
||||
p = skip_string(param,sizeof(param),p);
|
||||
safe_strcpy_base(p,"WWzWWDDzz", param, sizeof(param)); /* returned data format */
|
||||
strlcpy_base(p,"WWzWWDDzz", param, sizeof(param)); /* returned data format */
|
||||
p = skip_string(param,sizeof(param),p);
|
||||
safe_strcpy_base(p,cli->share, param, sizeof(param)); /* name of queue */
|
||||
strlcpy_base(p,cli->share, param, sizeof(param)); /* name of queue */
|
||||
p = skip_string(param,sizeof(param),p);
|
||||
SSVAL(p,0,2); /* API function level 2, PRJINFO_2 data structure */
|
||||
SSVAL(p,2,1000); /* size of bytes of returned data buffer */
|
||||
p += 4;
|
||||
safe_strcpy_base(p,"", param,sizeof(param)); /* subformat */
|
||||
strlcpy_base(p,"", param,sizeof(param)); /* subformat */
|
||||
p = skip_string(param,sizeof(param),p);
|
||||
|
||||
DEBUG(4,("doing cli_print_queue for %s\n", cli->share));
|
||||
@ -136,9 +136,9 @@ int cli_printjob_del(struct cli_state *cli, int job)
|
||||
p = param;
|
||||
SSVAL(p,0,81); /* DosPrintJobDel() */
|
||||
p += 2;
|
||||
safe_strcpy_base(p,"W", param,sizeof(param));
|
||||
strlcpy_base(p,"W", param,sizeof(param));
|
||||
p = skip_string(param,sizeof(param),p);
|
||||
safe_strcpy_base(p,"", param,sizeof(param));
|
||||
strlcpy_base(p,"", param,sizeof(param));
|
||||
p = skip_string(param,sizeof(param),p);
|
||||
SSVAL(p,0,job);
|
||||
p += 2;
|
||||
|
@ -2087,7 +2087,7 @@ bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
|
||||
SSVAL(ptr,smb_vwv15,1);
|
||||
SSVAL(ptr,smb_vwv16,2);
|
||||
p2 = smb_buf(ptr);
|
||||
safe_strcpy_base(p2, mailslot, dgram->data, sizeof(dgram->data));
|
||||
strlcpy_base(p2, mailslot, dgram->data, sizeof(dgram->data));
|
||||
p2 = skip_string(ptr,MAX_DGRAM_SIZE,p2);
|
||||
|
||||
if (((p2+len) > dgram->data+sizeof(dgram->data)) || ((p2+len) < p2)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user