From owner-svn-ports-head@freebsd.org Sun Dec 9 11:49:15 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B68A2131826A; Sun, 9 Dec 2018 11:49:15 +0000 (UTC) (envelope-from krion@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56C1886516; Sun, 9 Dec 2018 11:49:15 +0000 (UTC) (envelope-from krion@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 324B610DA7; Sun, 9 Dec 2018 11:49:15 +0000 (UTC) (envelope-from krion@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB9BnFuW020557; Sun, 9 Dec 2018 11:49:15 GMT (envelope-from krion@FreeBSD.org) Received: (from krion@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB9BnElG020555; Sun, 9 Dec 2018 11:49:14 GMT (envelope-from krion@FreeBSD.org) Message-Id: <201812091149.wB9BnElG020555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: krion set sender to krion@FreeBSD.org using -f From: Kirill Ponomarev Date: Sun, 9 Dec 2018 11:49:14 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r487040 - head/mail/tpop3d/files X-SVN-Group: ports-head X-SVN-Commit-Author: krion X-SVN-Commit-Paths: head/mail/tpop3d/files X-SVN-Commit-Revision: 487040 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 56C1886516 X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; NEURAL_HAM_LONG(-0.99)[-0.991,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Dec 2018 11:49:16 -0000 Author: krion Date: Sun Dec 9 11:49:14 2018 New Revision: 487040 URL: https://svnweb.freebsd.org/changeset/ports/487040 Log: Add forgotten patches by previous commit. Pointy hat to: krion Added: head/mail/tpop3d/files/patch-buffer.c (contents, props changed) head/mail/tpop3d/files/patch-buffer.h (contents, props changed) head/mail/tpop3d/files/patch-connection.c (contents, props changed) Added: head/mail/tpop3d/files/patch-buffer.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/tpop3d/files/patch-buffer.c Sun Dec 9 11:49:14 2018 (r487040) @@ -0,0 +1,65 @@ +--- buffer.c.orig 2008-03-31 19:37:15 UTC ++++ buffer.c +@@ -136,46 +136,36 @@ char *buffer_consume_all(buffer B, char *str, size_t * + return str; + } + +-/* buffer_consume_to_mark BUFFER MARK MLEN STR SLEN +- * Consume data from BUFFER up to and including MARK of length MLEN, returning ++/* buffer_consume_to_mark BUFFER MARK STR SLEN ++ * Consume data from BUFFER up to and including single character MARK, returning + * a pointer to a string allocated with malloc(3) or NULL if the mark was not + * found. The number of bytes consumed is recorded in SLEN. If STR is not + * NULL, it must point to a buffer of length at least *SLEN allocated with + * malloc(3); this buffer will be used as is if the returned string is small + * enough, or reallocated with realloc(3) otherwise. The returned string is +- * null-terminated. +- * +- * This uses a Boyer-Moore search, but we can't just reuse memstr because we +- * may have to search across the end of the buffer. */ +-char *buffer_consume_to_mark(buffer B, const char *mark, const size_t mlen, char *str, size_t *slen) { +- size_t skip[256], a; ++ * null-terminated. */ ++char *buffer_consume_to_mark(buffer B, const char *mark, char *str, size_t *slen) { ++ size_t a; + int k; + + assert(B); +- assert(mlen > 0 && mlen <= (size_t)INT_MAX); + +- if ((a = buffer_available(B)) < mlen) return NULL; ++ if ((a = buffer_available(B)) < 1) return NULL; + + assert(a <= (size_t)INT_MAX); + +- /* Oh dear. Should special-case the mlen == 1 case, since it's the only +- * one we use.... */ +- for (k = 0; k < 256; ++k) skip[k] = mlen; +- for (k = 0; k < (int)mlen - 1; ++k) skip[(unsigned char)mark[k]] = mlen - k - 1; +- +- for (k = (int)mlen - 1; k < (int)a; k += skip[(unsigned char)mark[k]]) { +- int i, j; +- for (j = (int)mlen - 1, i = k; j >= 0 && B->buf[(B->get + i) % B->len] == mark[j]; j--) i--; +- if (j == -1) { +- /* Have found the mark at location i + 1. */ +- i += 1 + mlen; /* account for mark and terminating null */ +- if (!str || *slen < (size_t)i + 1) +- str = xrealloc(str, (size_t)i + 1); +- *slen = (size_t)i + 1; +- for (j = 0; j < i; ++j) ++ for (k = 0; k < (int)a; k++) { ++ if (B->buf[(B->get + k) % B->len] == mark[0]) { ++ int j, len; ++ /* Have found the mark at location k. */ ++ len = k + 1; /* string length */ ++ if (!str || *slen < (size_t)len + 1) ++ str = xrealloc(str, (size_t)len + 1); ++ *slen = (size_t)len + 1; ++ for (j = 0; j < len; j++) + str[j] = B->buf[(B->get + j) % B->len]; + str[j] = 0; +- B->get = (B->get + i) % B->len; ++ B->get = (B->get + len) % B->len; + return str; + } + } Added: head/mail/tpop3d/files/patch-buffer.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/tpop3d/files/patch-buffer.h Sun Dec 9 11:49:14 2018 (r487040) @@ -0,0 +1,11 @@ +--- buffer.h.orig 2008-03-31 19:37:15 UTC ++++ buffer.h +@@ -41,7 +41,7 @@ void buffer_make_contiguous(buffer B); + char *buffer_get_consume_ptr(buffer B, size_t *slen); + void buffer_consume_bytes(buffer B, const size_t num); + char *buffer_consume_all(buffer B, char *str, size_t *slen); +-char *buffer_consume_to_mark(buffer B, const char *mark, const size_t mlen, char *str, size_t *slen); ++char *buffer_consume_to_mark(buffer B, const char *mark, char *str, size_t *slen); + void buffer_expand(buffer B, const size_t num); + void buffer_push_data(buffer B, const char *data, const size_t dlen); + char *buffer_get_push_ptr(buffer B, size_t *len); Added: head/mail/tpop3d/files/patch-connection.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/tpop3d/files/patch-connection.c Sun Dec 9 11:49:14 2018 (r487040) @@ -0,0 +1,11 @@ +--- connection.c.orig 2008-07-12 13:48:22 UTC ++++ connection.c +@@ -316,7 +316,7 @@ pop3command connection_parsecommand(connection c) { + * latter case we must be careful not to interpret command1\ncommand2\r\n + * as a single command. So always use \n as the line ending and strip off + * any trailing \r. */ +- if (!(p = buffer_consume_to_mark(c->rdb, "\n", 1, line, &llen))) ++ if (!(p = buffer_consume_to_mark(c->rdb, "\n", line, &llen))) + return NULL; + else + line = p;