From owner-freebsd-bugs@FreeBSD.ORG Fri May 19 06:10:15 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 363F616A421 for ; Fri, 19 May 2006 06:10:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9447043D46 for ; Fri, 19 May 2006 06:10:14 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k4J6AEsp045578 for ; Fri, 19 May 2006 06:10:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k4J6AE4X045577; Fri, 19 May 2006 06:10:14 GMT (envelope-from gnats) Resent-Date: Fri, 19 May 2006 06:10:14 GMT Resent-Message-Id: <200605190610.k4J6AE4X045577@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, =?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9CBFA16A421 for ; Fri, 19 May 2006 06:06:15 +0000 (UTC) (envelope-from mbsd@pacbell.net) Received: from ylpvm01.prodigy.net (ylpvm01-ext.prodigy.net [207.115.57.32]) by mx1.FreeBSD.org (Postfix) with ESMTP id 07B7D43D45 for ; Fri, 19 May 2006 06:06:14 +0000 (GMT) (envelope-from mbsd@pacbell.net) Received: from pimout5-ext.prodigy.net (pimout5-int.prodigy.net [207.115.4.21]) by ylpvm01.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id k4J66ApW015192 for ; Fri, 19 May 2006 02:06:10 -0400 Received: from antec (ppp-71-139-49-46.dsl.snfc21.pacbell.net [71.139.49.46]) by pimout5-ext.prodigy.net (8.13.6 out.dk/8.13.6) with ESMTP id k4J666Dp265862 for ; Fri, 19 May 2006 02:06:10 -0400 Message-Id: <20060518230326.K24316@antec.home> Date: Thu, 18 May 2006 23:06:03 -0700 (PDT) From: =?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= To: FreeBSD-gnats-submit@FreeBSD.org Cc: Subject: bin/97485: [Patch] Incorrect conversion in a64l(3) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 May 2006 06:10:15 -0000 >Number: 97485 >Category: bin >Synopsis: [Patch] Incorrect conversion in a64l(3) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri May 19 06:10:13 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Mikko Tyolajarvi >Release: FreeBSD 6.1-STABLE i386 >Organization: >Environment: System: FreeBSD antec.home 6.1-STABLE FreeBSD 6.1-STABLE #10: Sun May 14 15:21:09 PDT 2006 mikko@antec.home:/x/usr/obj/usr/src/sys/ANTEC i386 The problem exists in both 6.1 and 7-current. >Description: Any string containing a "/" character is decoded incorrectly. For example, the string "/" should decode to the value 1 (it even says so in the man page), but on FreeBSD the result is 3. >How-To-Repeat: #include int main() { assert(a64l("/") == 1); return 0; } >Fix: Here are some suggestions, all of which work: 1) --- a64l.c.orig Thu May 18 22:55:23 2006 +++ a64l.c Thu May 18 22:55:35 2006 @@ -16,7 +16,7 @@ #include #define ADOT 46 /* ASCII '.' */ -#define ASLASH ADOT + 1 /* ASCII '/' */ +#define ASLASH (ADOT + 1) /* ASCII '/' */ #define A0 48 /* ASCII '0' */ #define AA 65 /* ASCII 'A' */ #define Aa 97 /* ASCII 'a' */ 2) --- a64l.c.orig Thu May 18 22:55:23 2006 +++ a64l.c Thu May 18 22:56:25 2006 @@ -16,7 +16,7 @@ #include #define ADOT 46 /* ASCII '.' */ -#define ASLASH ADOT + 1 /* ASCII '/' */ +#define ASLASH 47 /* ASCII '/' */ #define A0 48 /* ASCII '0' */ #define AA 65 /* ASCII 'A' */ #define Aa 97 /* ASCII 'a' */ 3) --- a64l.c.orig Thu May 18 22:55:23 2006 +++ a64l.c Thu May 18 22:57:47 2006 @@ -31,7 +31,7 @@ shift = 0; for (i = 0; *s != '\0' && i < 6; i++, s++) { if (*s <= ASLASH) - digit = *s - ASLASH + 1; + digit = *s - ADOT; else if (*s <= A0 + 9) digit = *s - A0 + 2; else if (*s <= AA + 25) 4) Use the unmodified code from NetBSD. $.02, /Mikko >Release-Note: >Audit-Trail: >Unformatted: