]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-file: Fixed a crash.
authorTimo Sirainen <tss@iki.fi>
Mon, 19 Jan 2009 17:08:24 +0000 (12:08 -0500)
committerTimo Sirainen <tss@iki.fi>
Mon, 19 Jan 2009 17:08:24 +0000 (12:08 -0500)
--HG--
branch : HEAD

src/lib-dict/dict-file.c

index 01d345c2a4c55120926e4801592ed9f2c8d99e1e..714bebb900af5b10e39fb0f22b80f548d25d6efd 100644 (file)
@@ -256,7 +256,7 @@ static void file_dict_apply_changes(struct file_dict_transaction_context *ctx)
                        diff += changes[i].value.diff;
                        tmp = t_strdup_printf("%lld", diff);
                        new_len = strlen(tmp);
-                       if (new_len > strlen(old_value))
+                       if (old_value == NULL || new_len > strlen(old_value))
                                value = p_strdup(dict->hash_pool, tmp);
                        else {
                                memcpy(old_value, tmp, new_len + 1);