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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-patches by date

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