summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-10-26 14:23:48 +0200
committerStefan Metzmacher <metze@samba.org>2011-10-26 15:33:30 +0200
commit7682f61e1003c6e43ba46013eb45248d676c4476 (patch)
tree96437606d79f0153d0ebbf60ac0306dc58ddc217
parent5f520e771786d416d55c8d0a84e411c73fc5396c (diff)
downloadsamba-7682f61e1003c6e43ba46013eb45248d676c4476.tar.gz
samba-7682f61e1003c6e43ba46013eb45248d676c4476.tar.bz2
samba-7682f61e1003c6e43ba46013eb45248d676c4476.zip
s3:include: implement trans_oob() as wrapper to smb_buffer_oob()
metze
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/include/smb_macros.h3
-rw-r--r--source3/lib/util.c19
3 files changed, 3 insertions, 20 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3002fc33da..6ff2854ca2 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -567,7 +567,6 @@ struct server_id interpret_pid(const char *pid_string);
char *procid_str_static(const struct server_id *pid);
bool procid_valid(const struct server_id *pid);
bool procid_is_local(const struct server_id *pid);
-bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 79d2f6833d..ef4b9bfccd 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -301,4 +301,7 @@ extern const char toupper_ascii_fast_table[];
#define toupper_ascii_fast(c) toupper_ascii_fast_table[(unsigned int)(c)];
#endif
+#define trans_oob(bufsize, offset, length) \
+ smb_buffer_oob(bufsize, offset, length)
+
#endif /* _SMB_MACROS_H */
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 8157c0ffd0..f547ec2a56 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2016,25 +2016,6 @@ bool procid_is_local(const struct server_id *pid)
}
/****************************************************************
- Check if offset/length fit into bufsize. Should probably be
- merged with is_offset_safe, but this would require a rewrite
- of lanman.c. Later :-)
-****************************************************************/
-
-bool trans_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;
-}
-
-/****************************************************************
Check if an offset into a buffer is safe.
If this returns True it's safe to indirect into the byte at
pointer ptr+off.