From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#55952: [PATCH] bindat (strz): Write null terminator after variable length string Date: Tue, 14 Jun 2022 15:52:02 +0300 Message-ID: <834k0ntnkd.fsf@gnu.org> References: <95d2ffc9-ac61-91fa-605e-f95507f81217@rhansen.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25095"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55952@debbugs.gnu.org, monnier@iro.umontreal.ca To: Richard Hansen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 14 15:04:53 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o16E1-0006Ev-3X for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Jun 2022 15:04:53 +0200 Original-Received: from localhost ([::1]:52266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o16E0-0006oe-65 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Jun 2022 09:04:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o162X-0005RP-V5 for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 08:53:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o162X-0006KC-NW for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 08:53:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o162X-0005m2-Io for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 08:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Jun 2022 12:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 55952-submit@debbugs.gnu.org id=B55952.165521114522151 (code B ref 55952); Tue, 14 Jun 2022 12:53:01 +0000 Original-Received: (at 55952) by debbugs.gnu.org; 14 Jun 2022 12:52:25 +0000 Original-Received: from localhost ([127.0.0.1]:33429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o161w-0005lD-UV for submit@debbugs.gnu.org; Tue, 14 Jun 2022 08:52:25 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o161u-0005kz-M9 for 55952@debbugs.gnu.org; Tue, 14 Jun 2022 08:52:23 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:35012) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o161n-0006GL-GN; Tue, 14 Jun 2022 08:52:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=FMgoeWqLnhHqr2doRqN33/7z7NeIqO+BFK8z2NnMiZ0=; b=A0Pn1m7RPrqV XdjqX3+uGq0xbFnoKeEn+SzXO2shgDz1QEs7Ut5FmMt/3YoZPWo9nYs/KGO+l9TW2VmABHV0aEauH /yg6HZ9Dg91IvYSZYKhE9S09/c/1Nr96vZH1Q03On4S7c8pcqG2G+YMITHeHcOBVHOu+t1RRN7jBf KYziUc3++nf5nDZ1mEUi6wN71FvNgfRQfFGchMDvzmjDfj9TIY6N5jxuOqfXuEgJrwyP35D7PbP/+ LFFi+rTABrnnO2jN5k+OHxrMQoNiXxzS8EedgHobiWZdjMTbz+3W/pMHeBwJYyyJRRCW6K5epOFdU dNLOcH7pAJVaaJ12yj2w4A==; Original-Received: from [87.69.77.57] (port=4711 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o161m-0001CZ-Cv; Tue, 14 Jun 2022 08:52:15 -0400 In-Reply-To: <95d2ffc9-ac61-91fa-605e-f95507f81217@rhansen.org> (message from Richard Hansen on Mon, 13 Jun 2022 17:48:15 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:234499 Archived-At: > Cc: monnier@iro.umontreal.ca > Date: Mon, 13 Jun 2022 17:48:15 -0400 > From: Richard Hansen > > Attached patch: > > * lisp/emacs-lisp/bindat.el (bindat--pack-strz): Explicitly write a > null byte after packing a variable-length string to ensure proper > termination when packing to a pre-allocated string. > * doc/lispref/processes.texi (Bindat Types): Update documentation. > * test/lisp/emacs-lisp/bindat-tests.el (bindat-test--str-strz-prealloc): > Update tests. Thanks, but AFAICT the documentation doesn't describe accurately enough what the modified code does: what if the pre-allocated destination string doesn't have enough storage for the null byte the code adds?