From: Timo Sirainen Date: Sat, 25 Feb 2012 02:38:01 +0000 (+0200) Subject: auth: auth_stream_reply_remove() left extra TABs to stream. X-Git-Tag: 2.1.2~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54dbde554c05afb4f0966d554d17e8cc5b190c1e;p=thirdparty%2Fdovecot%2Fcore.git auth: auth_stream_reply_remove() left extra TABs to stream. Normally this wouldn't really affect anything, except log some extra debug messages. --- diff --git a/src/auth/auth-stream.c b/src/auth/auth-stream.c index 0c0d7d3c62..d62c36984d 100644 --- a/src/auth/auth-stream.c +++ b/src/auth/auth-stream.c @@ -76,15 +76,16 @@ void auth_stream_reply_remove(struct auth_stream_reply *reply, const char *key) if (!auth_stream_reply_find_area(reply, key, &idx, &len)) return; - if (str_len(reply->str) < idx + len) { - /* remove also trailing tab */ - len++; - } else if (str_len(reply->str) == idx + len && idx > 0) { - /* removing last item, remove preceding tab */ + if (idx == 0 && str_len(reply->str) == len) { + /* removing the only item */ + } else if (str_len(reply->str) == idx + len) { + /* removing the last item -> remove the preceding tab */ len++; idx--; + } else { + /* remove the trailing tab */ + len++; } - str_delete(reply->str, idx, len); }