changeset 19226:e5164f14723f

dict-client: Avoid crash if server disconnects during transaction commit. Found by Coverity.
author Timo Sirainen <tss@iki.fi>
date Sun, 27 Sep 2015 21:28:25 +0300
parents 038efefc7e70
children a887dc2b3fb9
files src/lib-dict/dict-client.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-dict/dict-client.c	Sun Sep 27 21:25:59 2015 +0300
+++ b/src/lib-dict/dict-client.c	Sun Sep 27 21:28:25 2015 +0300
@@ -797,10 +797,12 @@
 			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);