From 6ff701e695e847414afb0320a6701fe252d3f311 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 16 Nov 2007 13:14:24 -0800 Subject: Match the 3.0.27a version of this function. Jeremy. (This used to be commit 629406cbe77a5d56a258ac414ab47f3e89183e52) --- source3/smbd/srvstr.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'source3/smbd/srvstr.c') diff --git a/source3/smbd/srvstr.c b/source3/smbd/srvstr.c index 68e61033ae..bae77d5d4b 100644 --- a/source3/smbd/srvstr.c +++ b/source3/smbd/srvstr.c @@ -23,24 +23,14 @@ extern int max_send; /* Make sure we can't write a string past the end of the buffer */ -size_t srvstr_push_fn(const char *function, unsigned int line, +size_t srvstr_push_fn(const char *function, unsigned int line, const char *base_ptr, uint16 smb_flags2, void *dest, const char *src, int dest_len, int flags) { - size_t buf_used = PTR_DIFF(dest, base_ptr); - if (dest_len == -1) { - if (((ptrdiff_t)dest < (ptrdiff_t)base_ptr) || (buf_used > (size_t)max_send)) { -#if 0 - DEBUG(0, ("Pushing string of 'unlimited' length into non-SMB buffer!\n")); -#endif - return push_string_fn(function, line, base_ptr, - smb_flags2, dest, src, -1, - flags); - } - return push_string_fn(function, line, base_ptr, smb_flags2, - dest, src, max_send - buf_used, flags); + if (dest_len < 0) { + return 0; } - + /* 'normal' push into size-specified buffer */ return push_string_fn(function, line, base_ptr, smb_flags2, dest, src, dest_len, flags); -- cgit