summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@sernet.de>2007-12-19 16:48:18 +0100
committerVolker Lendecke <vl@samba.org>2007-12-19 16:57:48 +0100
commit0743d384a634ad9c124673f52b9c2d17aab1ac89 (patch)
treeccb3b305b0fd315b2a314f7dcd8ab1359f5c3114 /source3/libsmb
parent2197801ef1d9a942c8f8ec8b8e81b9f25cffc02f (diff)
downloadsamba-0743d384a634ad9c124673f52b9c2d17aab1ac89.tar.gz
samba-0743d384a634ad9c124673f52b9c2d17aab1ac89.tar.bz2
samba-0743d384a634ad9c124673f52b9c2d17aab1ac89.zip
Some paranoia checks
(This used to be commit ff644cfa1b123e9d0f8f4817504e5b209b85dedd)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/unexpected.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source3/libsmb/unexpected.c b/source3/libsmb/unexpected.c
index 195668c44a..5fbc33cdf5 100644
--- a/source3/libsmb/unexpected.c
+++ b/source3/libsmb/unexpected.c
@@ -88,6 +88,10 @@ static int traverse_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *st
{
struct unexpected_key key;
+ if (kbuf.dsize != sizeof(key)) {
+ tdb_delete(ttdb, kbuf);
+ }
+
memcpy(&key, kbuf.dptr, sizeof(key));
if (lastt - key.timestamp > NMBD_UNEXPECTED_TIMEOUT) {
@@ -136,6 +140,10 @@ static int traverse_match(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf,
int port;
struct packet_struct *p;
+ if (kbuf.dsize != sizeof(key)) {
+ return 0;
+ }
+
memcpy(&key, kbuf.dptr, sizeof(key));
if (key.packet_type != state->match_type) return 0;