From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: gmane.lisp.guile.user Subject: Re: Guile bugs Date: Mon, 11 Sep 2017 11:10:55 +0300 Message-ID: <87k215odtc.fsf@elektro.pacujo.net> References: <87lgtajpkc.fsf@web.de> <87h8y7ruuz.fsf_-_@gnu.org> <87y3pm7l6j.fsf@gnu.org> <87wp55elvs.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1505117490 16611 195.159.176.226 (11 Sep 2017 08:11:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Sep 2017 08:11:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Guile User To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Sep 11 10:11:19 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drJoI-0003dE-Eh for guile-user@m.gmane.org; Mon, 11 Sep 2017 10:11:14 +0200 Original-Received: from localhost ([::1]:56060 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drJoP-0002Lw-Kj for guile-user@m.gmane.org; Mon, 11 Sep 2017 04:11:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drJo4-0002Lp-6F for guile-user@gnu.org; Mon, 11 Sep 2017 04:11:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drJo3-0006no-Cc for guile-user@gnu.org; Mon, 11 Sep 2017 04:11:00 -0400 Original-Received: from [2001:1bc8:1a0:5384:7a2b:cbff:fe9f:e508] (port=48992 helo=pacujo.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drJo3-0006nD-4d; Mon, 11 Sep 2017 04:10:59 -0400 Original-Received: from elektro.pacujo.net (192.168.1.200) by elektro.pacujo.net; Mon, 11 Sep 2017 11:10:55 +0300 Original-Received: by elektro.pacujo.net (sSMTP sendmail emulation); Mon, 11 Sep 2017 11:10:55 +0300 In-Reply-To: <87wp55elvs.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Mon, 11 Sep 2017 09:26:47 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:1bc8:1a0:5384:7a2b:cbff:fe9f:e508 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14115 Archived-At: ludo@gnu.org (Ludovic Court=C3=A8s): > I don=E2=80=99t know to what extent that is applicable to your software, = but my > recommendation would be to treat that network socket as a Scheme port, > pass it to =E2=80=98read=E2=80=99, and pass the result to =E2=80=98eval= =E2=80=99 (as opposed to reading > the whole string from C++ and passing it to =E2=80=98scm_eval_string=E2= =80=99.) Octet stream sockets break the stream at arbitrary locations. Eval isn't going to like it if you blindly hand bytes over to it. You first need to break the stream into complete S-expressions. Note also that the socket might not even respect UTF-8 boundaries so you can't assume you can read the bytes as text. Secondly, this lucrative pattern can be very dangerous as it allows arbitrary code to be executed at the peer end. In most applications, it is better to interpret the S-expressions explicitly. Marko