Re: C Extension woes

Поиск
Список
Период
Сортировка
От Andrew Chernow
Тема Re: C Extension woes
Дата
Msg-id 48A2C327.7060900@esilo.com
обсуждение исходный текст
Ответ на C Extension woes  (Tim Hawes <thawes@novadine.com>)
Ответы Re: C Extension woes  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: C Extension woes  (Tim Hawes <thawes@novadine.com>)
Список pgsql-hackers
Tim Hawes wrote:
> 
> text * pl_masterkey(PG_FUNCTION_ARGS)
> {
>  char *e_var = getenv("PGMASTERKEY");
>  size_t length = VARSIZE(e_var) - VARHDRSZ;
> 
> 

The VARSIZE macro is for variable length structures, like a text or 
bytea which contains a length and data member.  You are using this macro 
on a regular C string "e_var".  Try this instead:

size_t length = e_var != NULL ? strlen(e_var) : 0;

-- 
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Replay attack of query cancel
Следующее
От: "Dmitry Koterov"
Дата:
Сообщение: Patch: propose to include 3 new functions into intarray and intagg