From nobody Thu Apr 25 11:46:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532688216591600.2894417265537; Fri, 27 Jul 2018 03:43:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5308483F40; Fri, 27 Jul 2018 10:43:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4197F60BE5; Fri, 27 Jul 2018 10:43:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 318FD18037EC; Fri, 27 Jul 2018 10:43:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6RAhYfF018736 for ; Fri, 27 Jul 2018 06:43:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 236BF21568A3; Fri, 27 Jul 2018 10:43:34 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-116-204.ams2.redhat.com [10.36.116.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E8292156897 for ; Fri, 27 Jul 2018 10:43:33 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Fri, 27 Jul 2018 12:43:32 +0200 Message-Id: <20180727104332.8259-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] search: protect x[-1] with length check X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 27 Jul 2018 10:43:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Otherwise, "Less than" and "Greater than" symbols in a search query cause an out-of-range access and a 500 server error. Reported by Steffen Goertz. Signed-off-by: Paolo Bonzini --- api/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/search.py b/api/search.py index ba3703c..63ccfaa 100644 --- a/api/search.py +++ b/api/search.py @@ -134,7 +134,7 @@ Search text keyword in the email message. Example: if term.startswith("age:"): cond =3D term[term.find(":") + 1:] q =3D self._process_age_term(query, cond) - elif term[0] in "<>": + elif term[0] in "<>" and len(term) > 1: q =3D self._process_age_term(query, term) elif term.startswith("from:"): cond =3D term[term.find(":") + 1:] --=20 2.17.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel