[PATCH] pgcrypto: Test for NULL before dereferencing pointer

Marti Raudsepp <marti@juffo.org>

From: Marti Raudsepp <marti@juffo.org>
To: pgsql-hackers@postgresql.org
Date: 2010-10-20T15:44:40Z
Lists: pgsql-hackers

Attachments

Hi pgsql-hackers,

Currently contrib/pgcrypto/pgp-pubenc.c contains code like:

uint8 algo = pk->algo;
if (pk == NULL)
...

However, if pk was NULL, then the if() condition would never be
reached because the pk->algo dereference would segfault.

This patch moves the dereference to below the condition which was the
intended behavior.

Regards,
Marti