summaryrefslogtreecommitdiff
path: root/source3/include/smb_macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'source3/include/smb_macros.h')
-rw-r--r--source3/include/smb_macros.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index def122727f0..de1322a503b 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -152,7 +152,7 @@
/* the remaining number of bytes in smb buffer 'buf' from pointer 'p'. */
#define smb_bufrem(buf, p) (smb_buflen(buf)-PTR_DIFF(p, smb_buf(buf)))
-#define smbreq_bufrem(req, p) (req->buflen - PTR_DIFF(p, req->buf))
+#define smbreq_bufrem(req, p) ((req)->buflen < PTR_DIFF((p), (req)->buf) ? 0 : (req)->buflen - PTR_DIFF((p), (req)->buf))
/* Note that chain_size must be available as an extern int to this macro. */