From 19d701ddf07d855128ded0cf2b573ce468e3bdd6 Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Wed, 20 Jan 2016 01:10:01 +0000 Subject: Removing Suricata and Audit from source repo, and updated build.sh to avoid building suricata. Will re-address this in C release via tar balls. Change-Id: I3710076f8b7f3313cb3cb5260c4eb0a6834d4f6e Signed-off-by: Ashlee Young --- framework/src/suricata/src/util-buffer.c | 87 -------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 framework/src/suricata/src/util-buffer.c (limited to 'framework/src/suricata/src/util-buffer.c') diff --git a/framework/src/suricata/src/util-buffer.c b/framework/src/suricata/src/util-buffer.c deleted file mode 100644 index d4f50b06..00000000 --- a/framework/src/suricata/src/util-buffer.c +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright (C) 2007-2012 Open Information Security Foundation - * - * You can copy, redistribute or modify this Program under the terms of - * the GNU General Public License version 2 as published by the Free - * Software Foundation. - * - * 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 - * version 2 along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -/** - * \file - * - * \author Anoop Saldanha - */ - -#include "suricata-common.h" -#include "suricata.h" -#include "util-debug.h" -#include "util-buffer.h" - -/* 10 mb */ -#define MAX_LIMIT 10485760 - -MemBuffer *MemBufferCreateNew(uint32_t size) -{ - if (size > MAX_LIMIT) { - SCLogWarning(SC_ERR_MEM_BUFFER_API, "Mem buffer asked to create " - "buffer with size greater than API limit - %d", MAX_LIMIT); - return NULL; - } - - uint32_t total_size = size + sizeof(MemBuffer); - - MemBuffer *buffer = SCMalloc(total_size); - if (unlikely(buffer == NULL)) { - return NULL; - } - memset(buffer, 0, total_size); - - buffer->size = size; - buffer->buffer = (uint8_t *)buffer + sizeof(MemBuffer); - - return buffer; -} - -/** \brief expand membuffer by size of 'expand_by' - * - * If expansion failed, buffer will still be valid. - * - * \retval result 0 ok, -1 expansion failed - */ -int MemBufferExpand(MemBuffer **buffer, uint32_t expand_by) { - if (((*buffer)->size + expand_by) > MAX_LIMIT) { - SCLogWarning(SC_ERR_MEM_BUFFER_API, "Mem buffer asked to create " - "buffer with size greater than API limit - %d", MAX_LIMIT); - return -1; - } - - uint32_t total_size = (*buffer)->size + sizeof(MemBuffer) + expand_by; - - MemBuffer *tbuffer = SCRealloc(*buffer, total_size); - if (unlikely(tbuffer == NULL)) { - return -1; - } - - *buffer = tbuffer; - (*buffer)->size += expand_by; - (*buffer)->buffer = (uint8_t *)tbuffer + sizeof(MemBuffer); - - SCLogDebug("expanded buffer by %u, size is now %u", expand_by, (*buffer)->size); - return 0; -} - -void MemBufferFree(MemBuffer *buffer) -{ - SCFree(buffer); - - return; -} -- cgit 1.2.3-korg