From nobody Mon Jun 6 19:12:49 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 112DF1BEC2E9; Mon, 6 Jun 2022 19:12:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LH36972ggz52Rv; Mon, 6 Jun 2022 19:12:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654542770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sF8CJeXUYQPeCgad2HDe0+hn+wfkUYDWOpSt/0rhEyU=; b=UCS1vCJr2RutuxDrkyIl/WdfEZ5if9rP7WO35yi9EKk6Bl/7+76NMRjeT5SxxfSyKeyk4w Toa0KkcSBQntuaeIWsEI3eYY6AyQXLlq21pr0JMJgiQUkuThvYGkPW4b+wigiiGIRJRvrP 3+/VZgiMKO2JHYIy+rh4uRrFoOpZ04ZmOGoxZRIeEdKoe4+DQ1Wke3lWFUyzRSjrhkYrPZ 4noqt2dhlIG76HbH6WxnjOl+a3yhGwjQa1Hwsg1qCU9SwUo1HAx6LHUJr6+fI6mgEiNQmY Wa0dV+coTdpE22ro7cnmNV49jracxc+Qi9cAPQWp/0JU03ndENBw+Wb56CeJbA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFB753E65; Mon, 6 Jun 2022 19:12:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 256JCnSA062657; Mon, 6 Jun 2022 19:12:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 256JCnuK062656; Mon, 6 Jun 2022 19:12:49 GMT (envelope-from git) Date: Mon, 6 Jun 2022 19:12:49 GMT Message-Id: <202206061912.256JCnuK062656@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alfonso S. Siciliano" Subject: git: 559de8eedbc5 - main - bsddialog(3): Fix text wrapping List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asiciliano X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 559de8eedbc5cc18982bb254527ed7fe2f8655b2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654542770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sF8CJeXUYQPeCgad2HDe0+hn+wfkUYDWOpSt/0rhEyU=; b=xEmmOi6If+WorCAqq5Y6zazljsFQ+dxmojEvqqY2Qr9sGvnLxn+E8KUbfaLbj+1/gDcrxw 4E5+qXk23qnVvX+q+rsWmGB1iB+91y73BCaqnn4VFYRma7MAlmI9BqvTvsqKvDvY+Eu+Yv zZArW1rF/MNZhLRpadlgeFIbmS+aQIJQVQmK+gMTu+hbuJo5bgL3Xs/NOr8Ej3tTJAzqvE a4nMyhuturWuOUm654z9pk1mPbFSEy5Ojr8PxHasTf/m9zSoO2FXVG79TMXwBfVFmWIgvp 6yWeQSCTBNxqMTJhLyojIdkNH7zzobsE/8Ldc0tpTAMkyPnbLSUKuMbNmoU7XQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654542770; a=rsa-sha256; cv=none; b=V19rzQvuBREfl/nKrq1/+LX3rrEtXgU4hCFsRhiLsZYYgr4pwHly7JoNGNip09Pn8xTKRY eNo3/BCRbI8FURRViapAt/X9wHDb5Ul8px8TPYjxTEvLND6NvDhbTXy6vVzjkG+V3Sobhw X6iIc72TYc3BNs2qfzuW7T1JnjwknSEx8SeJbOqIZUnvW0BLeR+XoqEoRuL8ZG8LxKFhKr QAx/y7P4PAvRCt9d1n+SBcSnRIWO9ELsNRVheYkVwctZPBxwa1CPlhnP6MX/Wf+F6vQeuF 5SESbn9PzgLj55wdFFeDDBeaP7fJqI93dY+rmtX+2+RD6EtAQUYWxM0YWF/MVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by asiciliano: URL: https://cgit.FreeBSD.org/src/commit/?id=559de8eedbc5cc18982bb254527ed7fe2f8655b2 commit 559de8eedbc5cc18982bb254527ed7fe2f8655b2 Author: Alfonso S. Siciliano AuthorDate: 2022-06-06 19:07:03 +0000 Commit: Alfonso S. Siciliano CommitDate: 2022-06-06 19:12:36 +0000 bsddialog(3): Fix text wrapping Fix text wrapping with more than 1024 words. Reported by: brd Reviewed by: bapt, brd Differential Revision: https://reviews.freebsd.org/D35413 --- contrib/bsddialog/lib/lib_util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/bsddialog/lib/lib_util.c b/contrib/bsddialog/lib/lib_util.c index 643830efd58c..506003b52c8d 100644 --- a/contrib/bsddialog/lib/lib_util.c +++ b/contrib/bsddialog/lib/lib_util.c @@ -443,9 +443,10 @@ text_autosize(struct bsddialog_conf *conf, const char *text, int maxrows, continue; } - if (nword + tablen >= maxwords) { + if (nword + tablen + 1 >= maxwords) { maxwords += 1024; - if (realloc(words, maxwords * sizeof(int)) == NULL) + words = realloc(words, maxwords * sizeof(int)); + if (words == NULL) RETURN_ERROR("Cannot realloc memory for text " "autosize"); } @@ -968,4 +969,4 @@ end_dialog(struct bsddialog_conf *conf, WINDOW *shadow, WINDOW *widget, *conf->get_height = h; if (conf->get_width != NULL) *conf->get_width = w; -} \ No newline at end of file +}