Search
lxdream.org :: lxdream :: r961:3541b280e0f1
lxdream 0.9.1
released Jun 29
Download Now
changeset961:3541b280e0f1
parent960:2f0819278fdb
child962:54a657069b81
authornkeynes
dateThu Jan 15 00:53:39 2009 +0000 (12 years ago)
Fix off-by-one buffer overflow
Fix '\%' to '%'
src/tools/actparse.c
1.1 --- a/src/tools/actparse.c Wed Jan 14 23:27:57 2009 +0000
1.2 +++ b/src/tools/actparse.c Thu Jan 15 00:53:39 2009 +0000
1.3 @@ -35,8 +35,7 @@
1.4 int add_action( char **actions, struct ruleset *rules, char *operation, char *action )
1.5 {
1.6 char *act = g_strchomp(action);
1.7 -
1.8 - char opclean[strlen(operation)];
1.9 + char opclean[strlen(operation)+1];
1.10 char *p = operation, *q = opclean;
1.11 int i;
1.12
1.13 @@ -61,6 +60,7 @@
1.14 }
1.15 }
1.16 *q = '\0';
1.17 +
1.18 strcpy( operation, g_strstrip(opclean) );
1.19
1.20 for( i=0; i<rules->rule_count; i++ ) {
1.21 @@ -119,7 +119,7 @@
1.22 if( af->yyposn == af->length ) {
1.23 af->token.symbol = END;
1.24 } else if( af->token.symbol == TEXT || /* ACTIONS must follow TEXT */
1.25 - (af->token.symbol == NONE && af->text[af->yyposn] == '\%' && af->text[af->yyposn+1] == '%') ) {
1.26 + (af->token.symbol == NONE && af->text[af->yyposn] == '%' && af->text[af->yyposn+1] == '%') ) {
1.27 /* Begin action block */
1.28 af->token.symbol = ACTIONS;
1.29
.