Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130220182253.GT6181@port70.net>
Date: Wed, 20 Feb 2013 19:22:53 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: Fwd: Alignment check in strlen

* Jonas Wagner <jonas.wagner@...l.ch> [2013-02-20 19:05:28 +0100]:
> attached is a patch that makes the alignment check in strlen more
> consistent with the one in memcpy, and hopefully faster.
> 

there is already a patch set to make string.h functions
more consistent

that addresses more issues but needs clean up

see febr 4 and 5
http://www.openwall.com/lists/musl/2013/02/

so yes at some point these should be fixed..

> In src/string/memcpy.c, I find the following:
> 
> #define ALIGN (sizeof(size_t)-1)
> if (((uintptr_t)d & ALIGN) != ((uintptr_t)s & ALIGN))
>   goto misaligned;
> 
> In src/string/strlen.c, a different check was used instead:
> 
> #define ALIGN (sizeof(size_t))
> for (; (uintptr_t)s % ALIGN; s++) if (!*s) return s-a;
> 
> I do not think there is any particular reason for this difference.
> 
> Best,
> Jonas


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.