[PATCH] Fix POSIX compliance in pgwin32_unsetenv()
Bryan Green <dbryan.green@gmail.com>
From: Bryan Green <dbryan.green@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2025-10-18T18:26:40Z
Lists: pgsql-hackers
Attachments
- 0001-Fix-POSIX-compliance-in-pgwin32_unsetenv.patch (text/plain) patch 0001
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
Commits
-
Fix POSIX compliance in pgwin32_unsetenv() for "name" argument
- 5274f11c1749 14.20 landed
- 4c3795c582db 15.15 landed
- 9666ce889e9a 16.11 landed
- 199a0ecbcff7 17.7 landed
- 52b05b068615 18.1 landed
- 29b039e9166d 19 (unreleased) landed