Changeset 448

Show
Ignore:
Timestamp:
03/30/06 01:49:17 (3 years ago)
Author:
common
Message:

shellcode-signatures
- sc_free_shellcodes(struct sc_shellcode *s); to free the mallocs
- added, and used

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/modules/shellcode-signatures/parser.h

    r436 r448  
    5656 
    5757extern struct sc_shellcode *sc_parse_file(const char *); 
     58extern int sc_free_shellcodes(struct sc_shellcode *s); 
    5859extern char *sc_get_error(); 
    5960 
  • nepenthes/trunk/modules/shellcode-signatures/parser.y

    r447 r448  
    280280} 
    281281 
     282int free_shellcode(struct sc_shellcode *s) 
     283{ 
     284        free(s->name); 
     285        free(s->author); 
     286        free(s->reference); 
     287        free(s->pattern); 
     288   return 0; 
     289} 
     290 
     291int sc_free_shellcodes(struct sc_shellcode *s) 
     292{ 
     293   struct sc_shellcode *next = s; 
     294   int i=0; 
     295   while ((next = s->next) != NULL) 
     296   { 
     297      free_shellcode(s); 
     298      s = next; 
     299      i++; 
     300   } 
     301   return i; 
     302} 
    282303 
    283304char *sc_get_namespace_by_numeric(int num) 
  • nepenthes/trunk/modules/shellcode-signatures/sch_namespace.cpp

    r445 r448  
    6464        m_MapItems = sc->map_items; 
    6565 
    66 //      m_Author        = sc->author; 
    67         m_Pattern       = sc->pattern; 
    68 //      m_Reference     = sc->reference; 
     66        if (sc->pattern != NULL) 
     67        { 
     68                m_Pattern       = sc->pattern; 
     69        }else 
     70        { 
     71                m_Pattern       = ""; 
     72        } 
     73         
     74 
     75        if (sc->author != NULL) 
     76        { 
     77                m_Author        = sc->author; 
     78        }else 
     79        { 
     80                m_Author        = "unknown"; 
     81        } 
     82         
     83         
     84 
     85        if (sc->reference != NULL) 
     86        { 
     87                m_Reference     = sc->reference; 
     88        }else 
     89        { 
     90                m_Reference = "no docs"; 
     91        } 
    6992 
    7093        m_Pcre = NULL; 
     
    77100} 
    78101 
    79  
    80102bool NamespaceShellcodeHandler::Init() 
    81103{ 
    82104        const char * pcreEerror; 
    83105        int32_t pcreErrorPos; 
     106 
    84107        if ( (m_Pcre = pcre_compile(m_Pattern.c_str(), PCRE_DOTALL, &pcreEerror, (int *)&pcreErrorPos, 0)) == NULL ) 
    85108        { 
  • nepenthes/trunk/modules/shellcode-signatures/sch_namespace_bindfiletransfer.hpp

    r445 r448  
    3131#define HAVE_NAMESPACE_BINDFILETRANSFER_HPP 
    3232 
    33 #include <stdint.h> 
     33 
    3434#include "sch_namespace.hpp" 
    3535 
  • nepenthes/trunk/modules/shellcode-signatures/shellcode-signatures.cpp

    r443 r448  
    5252#undef STDTAGS  
    5353#endif 
    54 #define STDTAGS l_mod | l_dia | l_hlr 
    55  
     54#define STDTAGS l_mod | l_sc 
    5655 
    5756 
     
    191190        } 
    192191 
    193          
     192        int freed_shellcode = sc_free_shellcodes(sc_free); 
     193 
     194        logSpam("Free'd %i shellcodes\n",freed_shellcode);  
    194195 
    195196        return load_success;