[PATCH] Fix POSIX compliance in pgwin32_unsetenv()

From: Bryan Green <dbryan(dot)green(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Fix POSIX compliance in pgwin32_unsetenv()
Date: 2025-10-18 18:26:40
Message-ID: b6a1e52b-d808-4df7-87f7-2ff48d15003e@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I noticed that pgwin32_unsetenv() in src/port/win32env.c lacks the input
validation that its sibling function pgwin32_setenv() has (lines 126-132).

Without these checks, the function will crash on NULL input via
strlen(NULL), and will accept empty strings or strings containing '=' in
violation of POSIX.1-2008.

The attached patch adds the same validation that pgwin32_setenv already
does, making the two functions consistent. This is purely defensive -
it only affects callers passing invalid arguments.

regards,

Bryan Green

Attachment Content-Type Size
0001-Fix-POSIX-compliance-in-pgwin32_unsetenv.patch text/plain 1.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message KAZAR Ayoub 2025-10-18 18:46:29 Re: Speed up COPY FROM text/CSV parsing using SIMD
Previous Message Philip Alger 2025-10-18 18:22:54 Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement