From 08101619fe693adc52ce4741a3588e6dac4d1379 Mon Sep 17 00:00:00 2001 From: Kirby Kuehl Date: Tue, 2 Mar 2010 11:19:51 -0600 Subject: [PATCH] make sure we have input_len --- src/app-layer-dcerpc-common.h | 14 ++++++++++++++ src/app-layer-dcerpc.c | 30 ++++++++++++++++++++++-------- src/app-layer-dcerpc.h | 14 ++++++++++++++ src/app-layer-nbss.h | 14 ++++++++++++++ src/app-layer-smb.c | 14 ++++++++++++++ src/app-layer-smb.h | 14 ++++++++++++++ src/app-layer-smb2.c | 14 ++++++++++++++ src/app-layer-smb2.h | 14 ++++++++++++++ 8 files changed, 120 insertions(+), 8 deletions(-) diff --git a/src/app-layer-dcerpc-common.h b/src/app-layer-dcerpc-common.h index e32697f..299d2c8 100644 --- a/src/app-layer-dcerpc-common.h +++ b/src/app-layer-dcerpc-common.h @@ -3,6 +3,20 @@ * app-layer-dcerpc.h * * \author Kirby Kuehl + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef APPLAYERDCERPCCOMMON_H_ diff --git a/src/app-layer-dcerpc.c b/src/app-layer-dcerpc.c index d7b8a63..7f2dffb 100644 --- a/src/app-layer-dcerpc.c +++ b/src/app-layer-dcerpc.c @@ -3,6 +3,20 @@ * app-layer-dcerpc.c * * \author Kirby Kuehl + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "suricata-common.h" #include "suricata.h" @@ -1084,8 +1098,8 @@ int32_t DCERPCParser(DCERPC *dcerpc, uint8_t *input, uint32_t input_len) { } while (dcerpc->bytesprocessed < DCERPC_HDR_LEN + 10 - + dcerpc->dcerpcbindbindack.secondaryaddrlen && input_len - && dcerpc->bytesprocessed < dcerpc->dcerpchdr.frag_length) { + + dcerpc->dcerpcbindbindack.secondaryaddrlen + && dcerpc->bytesprocessed < dcerpc->dcerpchdr.frag_length && input_len) { retval = DCERPCParseSecondaryAddr(dcerpc, input + parsed, input_len); if (retval) { parsed += retval; @@ -1110,8 +1124,8 @@ int32_t DCERPCParser(DCERPC *dcerpc, uint8_t *input, uint32_t input_len) { } while (dcerpc->bytesprocessed < DCERPC_HDR_LEN + 10 - + dcerpc->dcerpcbindbindack.secondaryaddrlen + dcerpc->pad && input_len - && dcerpc->bytesprocessed < dcerpc->dcerpchdr.frag_length) { + + dcerpc->dcerpcbindbindack.secondaryaddrlen + dcerpc->pad + && dcerpc->bytesprocessed < dcerpc->dcerpchdr.frag_length && input_len) { retval = PaddingParser(dcerpc, input + parsed, input_len); if (retval) { parsed += retval; @@ -1129,7 +1143,7 @@ int32_t DCERPCParser(DCERPC *dcerpc, uint8_t *input, uint32_t input_len) { while (dcerpc->bytesprocessed >= DCERPC_HDR_LEN + 10 + dcerpc->pad + dcerpc->dcerpcbindbindack.secondaryaddrlen && dcerpc->bytesprocessed < DCERPC_HDR_LEN + 14 + dcerpc->pad + dcerpc->dcerpcbindbindack.secondaryaddrlen - && dcerpc->bytesprocessed < dcerpc->dcerpchdr.frag_length) { + && dcerpc->bytesprocessed < dcerpc->dcerpchdr.frag_length && input_len) { retval = DCERPCGetCTXItems(dcerpc, input + parsed, input_len); if (retval) { parsed += retval; @@ -1148,8 +1162,8 @@ int32_t DCERPCParser(DCERPC *dcerpc, uint8_t *input, uint32_t input_len) { dcerpc->dcerpcbindbindack.ctxbytesprocessed = 0; } - while (dcerpc->dcerpcbindbindack.numctxitemsleft && input_len && dcerpc->bytesprocessed - < dcerpc->dcerpchdr.frag_length) { + while (dcerpc->dcerpcbindbindack.numctxitemsleft && dcerpc->bytesprocessed + < dcerpc->dcerpchdr.frag_length && input_len) { retval = DCERPCParseBINDACKCTXItem(dcerpc, input + parsed, input_len); if (retval) { if (dcerpc->dcerpcbindbindack.ctxbytesprocessed == 24) { @@ -1191,7 +1205,7 @@ int32_t DCERPCParser(DCERPC *dcerpc, uint8_t *input, uint32_t input_len) { } while (dcerpc->bytesprocessed >= DCERPC_HDR_LEN + 8 && dcerpc->bytesprocessed < dcerpc->dcerpchdr.frag_length - && input_len && dcerpc->padleft) { + && dcerpc->padleft && input_len) { retval = StubDataParser(dcerpc, input + parsed, input_len); if (retval) { parsed += retval; diff --git a/src/app-layer-dcerpc.h b/src/app-layer-dcerpc.h index d63cab8..21cdfdc 100644 --- a/src/app-layer-dcerpc.h +++ b/src/app-layer-dcerpc.h @@ -3,6 +3,20 @@ * app-layer-dcerpc.h * * \author Kirby Kuehl + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef APPLAYERDCERPC_H_ diff --git a/src/app-layer-nbss.h b/src/app-layer-nbss.h index 42a8ff1..db1320a 100644 --- a/src/app-layer-nbss.h +++ b/src/app-layer-nbss.h @@ -3,6 +3,20 @@ * app-layer-nbss.h * * \author Kirby Kuehl + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef APPLAYERNBSS_H_ diff --git a/src/app-layer-smb.c b/src/app-layer-smb.c index 4b0a65b..6ceccea 100644 --- a/src/app-layer-smb.c +++ b/src/app-layer-smb.c @@ -3,6 +3,20 @@ * app-layer-smb.c * * \author Kirby Kuehl + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "suricata-common.h" diff --git a/src/app-layer-smb.h b/src/app-layer-smb.h index df624b9..cdba107 100644 --- a/src/app-layer-smb.h +++ b/src/app-layer-smb.h @@ -3,6 +3,20 @@ * app-layer-smb.h * * \author Kirby Kuehl + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef APPLAYERSMB_H_ diff --git a/src/app-layer-smb2.c b/src/app-layer-smb2.c index e2d14f1..961c58d 100644 --- a/src/app-layer-smb2.c +++ b/src/app-layer-smb2.c @@ -3,6 +3,20 @@ * app-layer-smb.c * * \author Kirby Kuehl + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "suricata-common.h" diff --git a/src/app-layer-smb2.h b/src/app-layer-smb2.h index 5304ab8..53a5360 100644 --- a/src/app-layer-smb2.h +++ b/src/app-layer-smb2.h @@ -3,6 +3,20 @@ * app-layer-smb2.h * * \author Kirby Kuehl + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef APPLAYERSMB2_H_ -- 1.6.6.1