[dovecot-cvs] dovecot/src/plugins/quota quota-dict.c,1.12,1.13

cras at dovecot.org cras at dovecot.org
Sat Jun 17 15:21:24 EEST 2006


Update of /var/lib/cvs/dovecot/src/plugins/quota
In directory talvi:/tmp/cvs-serv25959

Modified Files:
	quota-dict.c 
Log Message:
Don't crash if dict_lookup() didn't return success.



Index: quota-dict.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-dict.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- quota-dict.c	16 Jun 2006 09:53:40 -0000	1.12
+++ quota-dict.c	17 Jun 2006 12:21:21 -0000	1.13
@@ -114,7 +114,7 @@
 		t_push();
 		ret = dict_lookup(root->dict, unsafe_data_stack_pool,
 				  DICT_QUOTA_CURRENT_BYTES_PATH, &value);
-		*value_r = value == NULL ? 0 : strtoull(value, NULL, 10) / 1024;
+		*value_r = ret <= 0 ? 0 : strtoull(value, NULL, 10) / 1024;
 		t_pop();
 	} else if (strcmp(name, QUOTA_NAME_MESSAGES) == 0) {
 		if (root->message_count_limit == (uint64_t)-1)
@@ -124,7 +124,7 @@
 		t_push();
 		ret = dict_lookup(root->dict, unsafe_data_stack_pool,
 				  DICT_QUOTA_CURRENT_COUNT_PATH, &value);
-		*value_r = value == NULL ? 0 : strtoull(value, NULL, 10);
+		*value_r = ret <= 0 ? 0 : strtoull(value, NULL, 10);
 		t_pop();
 	} else {
 		return 0;



More information about the dovecot-cvs mailing list