[PATCH] pgcrypto: Test for NULL before dereferencing pointer

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] pgcrypto: Test for NULL before dereferencing pointer
Date: 2010-10-20 15:44:40
Message-ID: AANLkTi=RiA-uvZfkxRQ5=9-duTM8FnQ_Sf4iUX071VqX@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-pgcrypto-Test-for-NULL-before-dereferencing-pointer.patch text/x-patch 1.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aidan Van Dyk 2010-10-20 16:10:29 Re: pg_rawdump
Previous Message Tom Lane 2010-10-20 15:37:02 Re: Creation of temporary tables on read-only standby servers