Search Postgresql Archives

Re: bytea field, a c function and pgcrypto driving me mad

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 30, 2008 at 05:27:58PM +0000, Glyn Astill wrote:
> Hi chaps,
> 
> I think I'm going to struggle to describe this, but hopefully someone can squint and see where I'm going wrong.
> 
> I've got a c function called "ftest", all it does is take some text and prepend "abcdefghijklmnopqr" onto it. I use it to pass a key into pgp_sym_encrypt/decrypt working on a bytea field in a table. The problem is that once the string I pass to "ftest" is longer than 10 characters it stops working when I use it with the bytea column and pgp_sym_decrypt, but it appears to work fine on it's own.
> 
> 1) The source is here:
> 
> http://privatepaste.com/890Bj3FGW0

ISTM that in this line:

keying = (text *)palloc( keylen + unamelen );

You forgot to include the length of the header VARHDRSZ.

Have  anice day,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while 
> boarding. Thank you for flying nlogn airlines.

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux