From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,865c3d125a8dbc3b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Howto read line from a stream Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <83317a97-dae5-4c84-a1ac-88a87833cf3f@q14g2000vbn.googlegroups.com> <1a90e055-44a3-4d00-b4cd-64798c731a55@e24g2000vbe.googlegroups.com> <16949835-6528-4a7a-a653-fd466b37bb45@s21g2000vbb.googlegroups.com> <18nn8atp3gdq1$.6g5cqv5h6u1c.dlg@40tude.net> Date: Tue, 2 Jun 2009 09:30:17 +0200 Message-ID: <1dlvlys7r0tyh$.zyytlf2vt5zm.dlg@40tude.net> NNTP-Posting-Date: 02 Jun 2009 09:30:16 CEST NNTP-Posting-Host: 466cdd17.newsspool3.arcor-online.net X-Trace: DXC=L`JT16:gW21Tia]Ho99G50McF=Q^Z^V384Fo<]lROoR1^YC2XCjHcb9LO7O4IaI:<0DNcfSJ;bb[5FCTGGVUmh?4LK[5LiR>kg2H:Vb`K4>i8? X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:6171 Date: 2009-06-02T09:30:16+02:00 List-Id: On Mon, 1 Jun 2009 18:30:31 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:18nn8atp3gdq1$.6g5cqv5h6u1c.dlg@40tude.net... > ... >>> My protocol says that every line ends with CR & LF, only length can >>> vary. >> >> The best practice of dealing with texts (streams or not) is to use LF as a >> line terminator and remove training (or any) CR's from the buffer. This >> makes it working under both Linux and Windows. > > That's lousy advice if he is working with a protocol that is defined outside > of his system. For instance, most Internet protocols (like HTTP, SMTP, and > FTP) require lines to be ended with CR LF. Lines that don't include the CR > are simply wrong and do not conform to the protocol. The originating system > is irrelevant, Windows, Linux, Mac, whatever. Indeed, the lack of those > characters is usually a good sign that spammers, malware, and the like is > trying to access your system. For instance, my spam filter blocks e-mail > messages that are missing the CRs required by the protocol, because only > clueless or sloppy systems miss them (in addition, some older e-mail clients > would crash on such messages, and there still is a danger to allowing them > through). I don't think it is a good idea, how to handle poorly designed and badly implemented protocols. We are living in a real world. It is silly to imply that an incoherent implementation should indicate a security problem. The problem is elsewhere, in the protocol itself. Anyways, I doubt that somebody could statistically confirm that the percentage of malformed line terminators is higher among unwanted postings. P.S. Do you remember early GNAT versions that refused to compile Ada source files with MS-DOS conventions when under Linux? Thank goodness, they are gone. P.P.S. There are lots of text-oriented protocols used in automotive. The device vendors just do not care to handle LFs and CRs as specified (if specified! (:-)). You buy a $10**5+ device and have to communicate with it. Guess which side has to be fixed? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de