@ -81,7 +81,7 @@ int SCClassConfInitContextAndLocalResources(DetectEngineCtx *de_ctx)
int opts = 0 ;
/* init the hash table to be used by the classification config Classtypes */
de_ctx - > class_conf_ht = HashTableInit ( 4096 , SCClassConfClasstypeHashFunc ,
de_ctx - > class_conf_ht = HashTableInit ( 128 , SCClassConfClasstypeHashFunc ,
SCClassConfClasstypeHashCompareFunc ,
SCClassConfClasstypeHashFree ) ;
if ( de_ctx - > class_conf_ht = = NULL ) {
@ -235,9 +235,9 @@ static char *SCClassConfStringToLowercase(const char *str)
*/
int SCClassConfAddClasstype ( char * rawstr , uint8_t index , DetectEngineCtx * de_ctx )
{
const char * ct_name = NULL ;
const char * ct_desc = NULL ;
const char * ct_priority_str = NULL ;
char ct_name [ 64 ] ;
char ct_desc [ 512 ] ;
char ct_priority_str [ 16 ] ;
int ct_priority = 0 ;
uint8_t ct_id = index ;
@ -256,23 +256,23 @@ int SCClassConfAddClasstype(char *rawstr, uint8_t index, DetectEngineCtx *de_ctx
}
/* retrieve the classtype name */
ret = pcre_ get _substring( ( char * ) rawstr , ov , 30 , 1 , & ct_name ) ;
ret = pcre_ copy _substring( ( char * ) rawstr , ov , 30 , 1 , ct_name , sizeof ( ct_name ) ) ;
if ( ret < 0 ) {
SCLogInfo ( " pcre_ get _substring() failed" ) ;
SCLogInfo ( " pcre_ copy _substring() failed" ) ;
goto error ;
}
/* retrieve the classtype description */
ret = pcre_ get _substring( ( char * ) rawstr , ov , 30 , 2 , & ct_desc ) ;
ret = pcre_ copy _substring( ( char * ) rawstr , ov , 30 , 2 , ct_desc , sizeof ( ct_desc ) ) ;
if ( ret < 0 ) {
SCLogInfo ( " pcre_ get _substring() failed" ) ;
SCLogInfo ( " pcre_ copy _substring() failed" ) ;
goto error ;
}
/* retrieve the classtype priority */
ret = pcre_ get _substring( ( char * ) rawstr , ov , 30 , 3 , & ct_priority_str ) ;
ret = pcre_ copy _substring( ( char * ) rawstr , ov , 30 , 3 , ct_priority_str , sizeof ( ct_priority_str ) ) ;
if ( ret < 0 ) {
SCLogInfo ( " pcre_ get _substring() failed" ) ;
SCLogInfo ( " pcre_ copy _substring() failed" ) ;
goto error ;
}
if ( ct_priority_str = = NULL ) {
@ -299,16 +299,9 @@ int SCClassConfAddClasstype(char *rawstr, uint8_t index, DetectEngineCtx *de_ctx
SCFree ( ct_new ) ;
}
if ( ct_name ) SCFree ( ( char * ) ct_name ) ;
if ( ct_desc ) SCFree ( ( char * ) ct_desc ) ;
if ( ct_priority_str ) SCFree ( ( char * ) ct_priority_str ) ;
return 0 ;
error :
if ( ct_name ) SCFree ( ( char * ) ct_name ) ;
if ( ct_desc ) SCFree ( ( char * ) ct_desc ) ;
if ( ct_priority_str ) SCFree ( ( char * ) ct_priority_str ) ;
return - 1 ;
}