s3:include: implement trans_oob() as wrapper to smb_buffer_oob()
authorStefan Metzmacher <metze@samba.org>
Wed, 26 Oct 2011 12:23:48 +0000 (14:23 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 26 Oct 2011 13:33:30 +0000 (15:33 +0200)
metze

source3/include/proto.h
source3/include/smb_macros.h
source3/lib/util.c

index 3002fc33daeb0b25da0f6693de4d35d77972c7bb..6ff2854ca2618dbfa9127ba4190faf319365fc5f 100644 (file)
@@ -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);
index 79d2f6833d07a8a45f5b82d07dc6399ffdd4fbf8..ef4b9bfccd8693473caba9f2ee3ee3e1c681a934 100644 (file)
@@ -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 */
index 8157c0ffd0d2c6005bde8f3d6d050931d8fc206b..f547ec2a5649e9b1f75ba80d5aec27fac3008950 100644 (file)
@@ -2015,25 +2015,6 @@ bool procid_is_local(const struct server_id *pid)
        return pid->vnn == my_vnn;
 }
 
-/****************************************************************
- 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