From 59c13056067d25e1cb9f2525625d1fe3dfed41e1 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Wed, 22 Jul 2009 00:51:36 +0200
Subject: [PATCH] Fixed potential segfault argument parameter validation.

---
 src/lib-sieve/sieve-validator.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lib-sieve/sieve-validator.c b/src/lib-sieve/sieve-validator.c
index d8b50539f..2bd49741e 100644
--- a/src/lib-sieve/sieve-validator.c
+++ b/src/lib-sieve/sieve-validator.c
@@ -766,6 +766,15 @@ bool sieve_validate_tag_parameter
 	struct sieve_ast_argument *tag, struct sieve_ast_argument *param,
 	enum sieve_ast_argument_type req_type)
 {
+	if ( param == NULL ) {
+		sieve_argument_validate_error(validator, tag, 
+			"the :%s tag for the %s %s requires %s as parameter, "
+			"but no more arguments were found", sieve_ast_argument_tag(tag), 
+			cmd->command->identifier, sieve_command_type_name(cmd->command),
+			sieve_ast_argument_type_name(req_type));
+		return FALSE;	
+	}
+
 	if ( sieve_ast_argument_type(param) != req_type && 
 		(sieve_ast_argument_type(param) != SAAT_STRING || 
 			req_type != SAAT_STRING_LIST) ) 
-- 
GitLab