Date: Tue, 06 Jul 2004 12:12:50 +0200 From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) To: Divacky Roman <xdivac02@stud.fit.vutbr.cz> Cc: current@freebsd.org Subject: Re: recent libalias changes Message-ID: <xzpeknpbg0t.fsf@dwp.des.no> In-Reply-To: <20040706082906.GA50212@stud.fit.vutbr.cz> (Divacky Roman's message of "Tue, 6 Jul 2004 10:29:06 %2B0200") References: <20040705133820.GA9159@stud.fit.vutbr.cz> <xzp1xjqbhee.fsf@dwp.des.no> <20040705161059.GA52584@walton.maths.tcd.ie> <xzpsmc6a02c.fsf@dwp.des.no> <xzpoemu9zfe.fsf@dwp.des.no> <20040706082906.GA50212@stud.fit.vutbr.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Divacky Roman <xdivac02@stud.fit.vutbr.cz> writes: > the patch works... > > pls commit Done. Could you please also test this one? It fixes an aliasing violation in another checksum function in libalias (at least partially, I may have to rewrite the entire function). DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=alias_util.diff Index: lib/libalias/alias_util.c =================================================================== RCS file: /home/ncvs/src/lib/libalias/alias_util.c,v retrieving revision 1.14 diff -u -r1.14 alias_util.c --- lib/libalias/alias_util.c 5 Jul 2004 11:10:57 -0000 1.14 +++ lib/libalias/alias_util.c 6 Jul 2004 10:09:57 -0000 @@ -73,9 +73,11 @@ nbytes -= 2; } if (nbytes == 1) { - oddbyte = 0; - ((u_char *) & oddbyte)[0] = *(u_char *) ptr; - ((u_char *) & oddbyte)[1] = 0; +#if BYTE_ORDER == LITTLE_ENDIAN + oddbyte = *(uint8_t *)ptr; +#else + oddbyte = *(uint8_t *)ptr * 256; +#endif sum += oddbyte; } sum = (sum >> 16) + (sum & 0xffff); --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpeknpbg0t.fsf>