lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181222222333.78eaa7ce@vmware.local.home>
Date:   Sat, 22 Dec 2018 22:23:33 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Ingo Molnar <mingo@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Joe Perches <joe@...ches.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Tom Zanussi <zanussi@...nel.org>,
        Andreas Schwab <schwab@...ux-m68k.org>, kernel-team@....com
Subject: Re: [PATCH v4] string.h: Add str_has_prefix() helper function

On Sun, 23 Dec 2018 12:13:43 +0900
Namhyung Kim <namhyung@...nel.org> wrote:

> > Also, I believe there are some memcmp implementations that start at the
> > end of the memory locations, not the beginning. That is, it compares
> > backwards. Which is also legit for memcmp to do.  
> 
> I'm not sure, the man page says:
> 
>     RETURN VALUE
>        The memcmp() function returns an integer less than, equal to,
>        or greater than zero if the first n bytes of s1 is found,
>        respectively, to be less than, to match, or be greater than
>        the first n bytes of s2.
> 
>        For a nonzero return value, the sign is determined by the sign
>        of the difference between the first pair of bytes (interpreted
>        as unsigned char) that differ in s1 and s2.
> 
>        If n is zero, the return value is zero.
> 
> 
> It should return difference in the first pair of bytes that differ so
> I guess implementations should compare from the beginning.

Ah, makes sense. I think I'm thinking of memcpy() which can start at
the end, or maybe even the deprecated bcmp(). It's been a long time
since I had to deal with the implementations of these.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ