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]
Date:	Mon, 14 Dec 2009 09:08:02 +0800
From:	Li Zefan <lizf@...fujitsu.com>
To:	rostedt@...dmis.org
CC:	Ingo Molnar <mingo@...e.hu>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Wenji Huang <wenji.huang@...cle.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/4] tracing/filters: Fix MATCH_EBD_ONLY filter matching

>>  static int regex_match_end(char *str, struct regex *r, int len)
>>  {
>> -	char *ptr = strstr(str, r->pattern);
>> +	int strlen = len - 1;
>>  
>> -	if (ptr && (ptr[r->len] == 0))
>> +	if (strlen >= r->len &&
>> +	    !memcmp(str + strlen - r->len, r->pattern, r->len))
> 
> Please use memcmp() == 0, I've seen too many bugs with !*cmp as well as
> with *cmp, because humans tend to think instinctively when reading this
> that ! is not a match. With "== 0" we think that "==" is a match and
>  "!=" is a miss.
> 

Though I sometimes don't care much about this, I do
think memcmp() == 0 is better.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ