]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-sql: Don't crash if iteration sees a NULL value in path.
authorTimo Sirainen <tss@iki.fi>
Thu, 9 Apr 2009 23:31:22 +0000 (19:31 -0400)
committerTimo Sirainen <tss@iki.fi>
Thu, 9 Apr 2009 23:31:22 +0000 (19:31 -0400)
--HG--
branch : HEAD

src/lib-dict/dict-sql.c

index 1260e4b44115e1516ec39844317b6522d26c5b12..8475047ca80f889b66e75b438c944721fd9b1564 100644 (file)
@@ -395,7 +395,7 @@ static int sql_dict_iterate(struct dict_iterate_context *_ctx,
 {
        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_iterate_context *_ctx,
                        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++;
                }
        }