]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-client: Avoid crash if server disconnects during transaction commit.
authorTimo Sirainen <tss@iki.fi>
Sun, 27 Sep 2015 18:28:25 +0000 (21:28 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 27 Sep 2015 18:28:25 +0000 (21:28 +0300)
Found by Coverity.

src/lib-dict/dict-client.c

index d0c23ca3f654b6411bd5bfe33fd25a31bde5c474..cf7e76d38f63d99a740c43da0ee81c447d0870a5 100644 (file)
@@ -797,10 +797,12 @@ client_dict_transaction_commit(struct dict_transaction_context *_ctx,
                        default:
                                i_error("dict-client: Invalid commit reply: %s", line);
                                client_dict_disconnect(dict);
+                               line = NULL;
                                ret = -1;
                                break;
                        }
-                       if (str_to_uint(line+1, &id) < 0 || ctx->id != id) {
+                       if (line != NULL &&
+                           (str_to_uint(line+1, &id) < 0 || ctx->id != id)) {
                                i_error("dict-client: Invalid commit reply, "
                                        "expected id=%u: %s", ctx->id, line);
                                client_dict_disconnect(dict);