Re: @(#) Mordred Labs advisory 0x0001: Buffer overflow - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: @(#) Mordred Labs advisory 0x0001: Buffer overflow
Date
Msg-id 20020821.101009.35794276.t-ishii@sra.co.jp
Whole thread Raw
In response to Re: @(#) Mordred Labs advisory 0x0001: Buffer overflow in  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: @(#) Mordred Labs advisory 0x0001: Buffer overflow in  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> > test=# \df iso8859_1_to_utf8
> >                                   List of functions
> >  Result data type |   Schema   |       Name        |       Argument data types       
> > ------------------+------------+-------------------+---------------------------------
> >  integer          | pg_catalog | iso8859_1_to_utf8 | integer, integer, -, -, integer
> 
> Right, that's what they are now, but what do the "-" entries really
> mean?  Also, are the "integer" args and result truthful, or do they
> really mean something else?

They are like:
* conv_proc(*        INTEGER,    -- source encoding id*        INTEGER,    -- destination encoding id*        OPAQUE,
    -- source string (null terminated C string)*        OPAQUE,        -- destination string (null terminated C
string)*       INTEGER        -- source string length
 

For the second and third argument they are actually treated as:

unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3);

The first one is an input parameter(source string), and second one is
an output parameter(destination string). The caller of this function
is responsible for allocationg enough memory for destination string.

The returned integer is actually dummy. The function always returns 1.
--
Tatsuo Ishii


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Large file support available
Next
From: Thomas Lockhart
Date:
Subject: Re: backpatch of datetime fixes