[asterisk-commits] eliel: branch group/data_api_gsoc2009 r205042 - /team/group/data_api_gsoc2009...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 7 10:17:23 CDT 2009


Author: eliel
Date: Tue Jul  7 10:17:20 2009
New Revision: 205042

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205042
Log:
Check if the comparison string is valid.


Modified:
    team/group/data_api_gsoc2009/main/data.c

Modified: team/group/data_api_gsoc2009/main/data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/main/data.c?view=diff&rev=205042&r1=205041&r2=205042
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Tue Jul  7 10:17:20 2009
@@ -756,6 +756,7 @@
 	char *elements, *search_string_dup;
 	int i;
 	struct ast_data_search *root, *child;
+	enum data_search_comparison cmp_type;
 
 	if (!search_string) {
 		ast_log(LOG_ERROR, "You must pass a valid search string.\n");
@@ -804,10 +805,16 @@
 			ast_str_append(&value, 0, "%c", elements[i]);
 		}
 
+		cmp_type = data_search_comparison_type(ast_str_buffer(comparison));
+		if (cmp_type == DATA_CMP_UNKNOWN) {
+			ast_log(LOG_ERROR, "Invalid comparison '%s'\n", ast_str_buffer(comparison));
+			continue;
+		}
+
 		/* add this node to the tree. */
 		child = data_search_create(root->children, ast_str_buffer(name));
 		if (child) {
-			child->cmp_type = data_search_comparison_type(ast_str_buffer(comparison));
+			child->cmp_type = cmp_type;
 			child->value = ast_strdup(ast_str_buffer(value));
 		}
 




More information about the asterisk-commits mailing list