diff options
author | Jeremy Allison <jra@samba.org> | 2007-04-02 19:04:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:04 -0500 |
commit | e5358d6c55cc0aae64447d32611bea4c249f0788 (patch) | |
tree | 7adb9526c03a12e9f02c11e5e3c07f78ce6d98f6 /source3/nmbd | |
parent | 6013b59b4456cd3989062e4428615b2aaa64a0cf (diff) | |
download | samba-e5358d6c55cc0aae64447d32611bea4c249f0788.tar.gz samba-e5358d6c55cc0aae64447d32611bea4c249f0788.tar.bz2 samba-e5358d6c55cc0aae64447d32611bea4c249f0788.zip |
r22042: Try and clean up my own mess using the API Volker
suggested. I now use :
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)
int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval)
int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval)
Volker, please criticize and comment. Thanks,
Jeremy.
(This used to be commit d47af7c9263f519e7307859b6a696d854c5dfca3)
Diffstat (limited to 'source3/nmbd')
-rw-r--r-- | source3/nmbd/nmbd_incomingdgrams.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_processlogon.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c index ef23f3a20d..ec8aa370ce 100644 --- a/source3/nmbd/nmbd_incomingdgrams.c +++ b/source3/nmbd/nmbd_incomingdgrams.c @@ -429,7 +429,7 @@ void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct unstring work_name; unstring source_name; fstring comment; - char *s = get_safe_offset(buf,len,buf,9); + char *s = get_safe_str_ptr(buf,len,buf,9); START_PROFILE(lm_host_announce); if (!s) { diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c index 6b10d61267..b23e6b996e 100644 --- a/source3/nmbd/nmbd_processlogon.c +++ b/source3/nmbd/nmbd_processlogon.c @@ -91,7 +91,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) )); pstrcpy(my_name, global_myname()); - code = get_safe_offset(buf,len,buf,2) ? SVAL(buf,0) : -1; + code = get_safe_SVAL(buf,len,buf,0,-1); DEBUG(4,("process_logon_packet: Logon from %s: code = 0x%x\n", inet_ntoa(p->ip), code)); switch (code) { |