summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/libsmb/nmblib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index 0681450bae2..8d387fe8120 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -160,6 +160,9 @@ static bool handle_name_ptrs(unsigned char *ubuf,int *offset,int length,
if (!*got_pointer)
(*ret) += 2;
(*got_pointer)=True;
+ if (*offset > length - 2) {
+ return False;
+ }
(*offset) = ((ubuf[*offset] & ~0xC0)<<8) | ubuf[(*offset)+1];
if (loop_count++ == 10 ||
(*offset) < 0 || (*offset)>(length-2)) {