Skip site navigation (1) Skip section navigation (2)

Re: Fix memcmp() with different sizes.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kurt Roeckx <Q(at)ping(dot)be>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Fix memcmp() with different sizes.
Date: 2004-02-03 02:27:46
Message-ID: 9475.1075775266@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Kurt Roeckx <Q(at)ping(dot)be> writes:
> -		if (memcmp(re_array[i].cre_pat, text_re, text_re_len) == 0 &&
> +		if (VARSIZE(re_array[i].cre_pat) == text_re_len &&
> +		memcmp(re_array[i].cre_pat, text_re, text_re_len) == 0 &&

This is not actually broken.  The first four bytes of what memcmp is
comparing are the length, and so it'll fall out immediately anyway if
the lengths differ.

			regards, tom lane

In response to

Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2004-02-03 03:31:40
Subject: Re: [PATCHES] log session end - again
Previous:From: Andrew DunstanDate: 2004-02-02 23:48:06
Subject: Re: [PATCHES] log session end - again

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group