Blob Blame History Raw
commit 553f2fa65865c31c5e3c48812cfd46176cffdd27
Author:  <davehart@shiny.ad.hartbrothers.com>
Date:   Wed Jul 28 05:33:53 2010 +0000

    [Bug 1593] ntpd abort in free() with logconfig syntax error.

diff --git a/ntpd/ntp_parser.y b/ntpd/ntp_parser.y
index b3f7ac3..cf8942f 100644
--- a/ntpd/ntp_parser.y
+++ b/ntpd/ntp_parser.y
@@ -995,14 +995,24 @@ log_config_list
 log_config_command
 	:	T_String
 		{
-			char prefix = $1[0];
-			char *type = $1 + 1;
+			char	prefix;
+			char *	type;
 			
-			if (prefix != '+' && prefix != '-' && prefix != '=') {
-				yyerror("Logconfig prefix is not '+', '-' or '='\n");
-			}
-			else
-				$$ = create_attr_sval(prefix, estrdup(type));
+			switch ($1[0]) {
+			
+			case '+':
+			case '-':
+			case '=':
+				prefix = $1[0];
+				type = $1 + 1;
+				break;
+				
+			default:
+				prefix = '=';
+				type = $1;
+			}	
+			
+			$$ = create_attr_sval(prefix, estrdup(type));
 			YYFREE($1);
 		}
 	;