summaryrefslogtreecommitdiff
path: root/libcli/smb/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcli/smb/util.c')
-rw-r--r--libcli/smb/util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libcli/smb/util.c b/libcli/smb/util.c
index b8c3dc5e96..b02ae00d0d 100644
--- a/libcli/smb/util.c
+++ b/libcli/smb/util.c
@@ -163,3 +163,15 @@ mode_t unix_filetype_from_wire(uint32_t wire_type)
}
}
+bool smb_buffer_oob(uint32_t bufsize, uint32_t offset, uint32_t length)
+{
+ if ((offset + length < offset) || (offset + length < length)) {
+ /* wrap */
+ return true;
+ }
+ if ((offset > bufsize) || (offset + length > bufsize)) {
+ /* overflow */
+ return true;
+ }
+ return false;
+}