Re: [PATCH 2/8] hex-escape: be more strict about the format while decoding
authorJani Nikula <jani@nikula.org>
Thu, 5 Apr 2012 11:49:42 +0000 (11:49 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:03 +0000 (09:46 -0800)
22/970e5bd5e8e53ed56803a01625b970a2ab08b6 [new file with mode: 0644]

diff --git a/22/970e5bd5e8e53ed56803a01625b970a2ab08b6 b/22/970e5bd5e8e53ed56803a01625b970a2ab08b6
new file mode 100644 (file)
index 0000000..709a997
--- /dev/null
@@ -0,0 +1,93 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 567C9431FB6\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Apr 2012 04:49:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id r8Ct+56Siksd for <notmuch@notmuchmail.org>;\r
+       Thu,  5 Apr 2012 04:49:49 -0700 (PDT)\r
+Received: from mail-qc0-f181.google.com (mail-qc0-f181.google.com\r
+       [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id B9F56431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Apr 2012 04:49:49 -0700 (PDT)\r
+Received: by qcsk26 with SMTP id k26so914560qcs.26\r
+       for <notmuch@notmuchmail.org>; Thu, 05 Apr 2012 04:49:48 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type:x-gm-message-state;\r
+       bh=WIL/pphOGlbGKX82FJX6p/HT1+uR88ccUaHaFWRZ+lE=;\r
+       b=XU/4/28o3mFB6WAz1nw/NUxs3ZIsvqkLiVb11q0/WGo/b4GBVtZrxCHevjnIcjKBVc\r
+       SKUDmj+Rknl/XpHXtzbe47tBf7nRDbC/14Plvem8K1Wvjl8+BlBlMOaRg3DQsFVLVwa6\r
+       +nlY5WhqCSPH0Xtr7MVutObFQ4VD4iZqzLVlT4ulCIqJDoltaJTui37xngZkYCoLe+Qh\r
+       5/fp2CgM+4GrqR0nNle9xYeDn6z9bQ5XOOM7uR+GBJ7c7/oEkARyVu07QncfmzG98EqJ\r
+       gjoIw3NRcss17YeCtPVDvDSMowcuCi6i6znzSJnLNzv5MLltn6sQl3JOTXYc+az/lUXE\r
+       h+XA==\r
+Received: by 10.224.209.74 with SMTP id gf10mr3698421qab.8.1333626588029;\r
+       Thu, 05 Apr 2012 04:49:48 -0700 (PDT)\r
+Received: from localhost (nikula.org. [92.243.24.172])\r
+       by mx.google.com with ESMTPS id dv7sm5777813qab.15.2012.04.05.04.49.44\r
+       (version=SSLv3 cipher=OTHER); Thu, 05 Apr 2012 04:49:46 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 2/8] hex-escape: be more strict about the format while\r
+       decoding\r
+In-Reply-To: <87fwcitnuk.fsf@zancas.localnet>\r
+References: <cover.1333231401.git.jani@nikula.org>\r
+       <81e543344ffe8e2761afd57a2268e8b362f4aef4.1333231401.git.jani@nikula.org>User-Agent:    Notmuch/0.12+70~g46e73fe (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu) <87fwcitnuk.fsf@zancas.localnet>\r
+User-Agent: Notmuch/0.11.1+222~ga47a98c (http://notmuchmail.org) Emacs/23.1.1\r
+       (i686-pc-linux-gnu)\r
+Date: Thu, 05 Apr 2012 11:49:42 +0000\r
+Message-ID: <87hawyxusp.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Gm-Message-State:\r
+ ALoCoQk4hl1VmUgwkmYyXD8wUAov4w10HLFgYJkUmk4x1+FtC/HdFpRW1Y0OtpMeCvOlyrwYW7bX\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 05 Apr 2012 11:49:50 -0000\r
+\r
+On Thu, 05 Apr 2012 08:33:23 -0300, David Bremner <david@tethera.net> wrote:\r
+> Jani Nikula <jani@nikula.org> writes:\r
+> \r
+> > Signed-off-by: Jani Nikula <jani@nikula.org>\r
+> >\r
+> > ---\r
+> >\r
+> > This could be folded to "hex-escape: (en|de)code strings to/from\r
+> > restricted character set".\r
+> \r
+> That's probably a good plan.\r
+> \r
+> > -      if (len < 3)\r
+> > +      if (!isxdigit ((unsigned char) p[1]) ||\r
+> > +          !isxdigit ((unsigned char) p[2]))\r
+> \r
+> What happens if there are not two characters after the escape? Is this\r
+> relying on calling isxdigit on the null terminator?\r
+\r
+It is, and technically there's nothing wrong with that. Would you prefer\r
+explicit checks for '\0' in the if condition, for clarity? Or a comment\r
+about it?\r
+\r
+Jani.\r