dovecot-1.3: dict-sql: Don't crash if iteration sees a NULL valu...

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 10 02:31:29 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.3/rev/40b5b098817b
changeset: 9056:40b5b098817b
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 09 19:31:22 2009 -0400
description:
dict-sql: Don't crash if iteration sees a NULL value in path.

diffstat:

1 file changed, 4 insertions(+), 3 deletions(-)
src/lib-dict/dict-sql.c |    7 ++++---

diffs (24 lines):

diff -r af9ac89e0910 -r 40b5b098817b src/lib-dict/dict-sql.c
--- a/src/lib-dict/dict-sql.c	Thu Apr 09 19:14:23 2009 -0400
+++ b/src/lib-dict/dict-sql.c	Thu Apr 09 19:31:22 2009 -0400
@@ -395,7 +395,7 @@ static int sql_dict_iterate(struct dict_
 {
 	struct sql_dict_iterate_context *ctx =
 		(struct sql_dict_iterate_context *)_ctx;
-	const char *p;
+	const char *p, *value;
 	unsigned int i, count;
 	int ret;
 
@@ -426,8 +426,9 @@ static int sql_dict_iterate(struct dict_
 			str_append_c(ctx->key, *p);
 		else {
 			i_assert(i < count);
-			str_append(ctx->key,
-				   sql_result_get_field_value(ctx->result, i));
+			value = sql_result_get_field_value(ctx->result, i);
+			if (value != NULL)
+				str_append(ctx->key, value);
 			i++;
 		}
 	}


More information about the dovecot-cvs mailing list