From owner-freebsd-wireless@freebsd.org Thu Dec 7 18:15:17 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91CD4E8DF03 for ; Thu, 7 Dec 2017 18:15:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80198703D7 for ; Thu, 7 Dec 2017 18:15:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id vB7IFHDx014990 for ; Thu, 7 Dec 2017 18:15:17 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-wireless@FreeBSD.org Subject: [Bug 224141] possible Off-by-one bug in the Base64 decoding in the wpa supplicant Date: Thu, 07 Dec 2017 18:15:17 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: wireless X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: tbrown@freeshell.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-wireless@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Dec 2017 18:15:17 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224141 Timothy Brown changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tbrown@freeshell.org --- Comment #1 from Timothy Brown --- Hi Ivan, I was wondering if you've got a test case that shows this "off-by-one"? As when I read the code, I do not believe there is an "off-by-one" error. The base64_table: static const unsigned char base64_table[65] =3D "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; Is defined as size 65, yet contains 64 elements and the last trailing NULL. So sizeof(base64_table) will return 65, yet the for loop is creating the=20 reverse base64 lookup in dtable, so we only want to do this for elements=20 in base64_table. Which is sizeof(base64_table) -1, or strlen(base64_table). This is my understanding of the code and I am unable to encode/decode an er= ror. I would be interested to hear your thoughts. Regards Tim --=20 You are receiving this mail because: You are the assignee for the bug.=