null iv parameter passed to combo_init()

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: null iv parameter passed to combo_init()
Date: 2022-01-08 00:32:01
Message-ID: CALNJ-vSBb2Ees=KB0frYBh7foK-QNZMbK7Vz66bUJa09D+CHAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
In contrib/pgcrypto/pgcrypto.c :

err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, NULL, 0);

Note: NULL is passed as iv.

When combo_init() is called,

if (ivlen > ivs)
memcpy(ivbuf, iv, ivs);
else
memcpy(ivbuf, iv, ivlen);

It seems we need to consider the case of null being passed as iv for
memcpy() because of this:

/usr/include/string.h:44:28: note: nonnull attribute specified here

What do you think of the following patch ?

Cheers

Attachment Content-Type Size
memcpy-null-iv.patch application/octet-stream 503 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2022-01-08 00:32:58 Re: [PoC] Delegating pg_ident to a third party
Previous Message Michael Paquier 2022-01-08 00:16:13 Re: pgsql: Refactor tar method of walmethods.c to rely on the compression m