[vlc-commits] [Git][videolan/vlc][3.0.x] contrib: gpg-error: disable calls to _putenv_s()

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Sep 4 14:24:15 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
f8304cd9 by Steve Lhomme at 2026-09-04T13:10:20+00:00
contrib: gpg-error: disable calls to _putenv_s()

It's not available in the msvcrt.dll found on Windows XP.
It's not documented as not available and even mingw-w64 doesn't have a code guard.

Ref. https://forum.videolan.org/viewtopic.php?f=14&t=167736&p=554900

- - - - -


2 changed files:

- + contrib/src/gpg-error/0017-sysutils-disable-_putenv_s-usage-not-available-in-Wi.patch
- contrib/src/gpg-error/rules.mak


Changes:

=====================================
contrib/src/gpg-error/0017-sysutils-disable-_putenv_s-usage-not-available-in-Wi.patch
=====================================
@@ -0,0 +1,45 @@
+From 11de6bb8d41ba7004fe1eb5e824b018a7b42affc Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Tue, 1 Sep 2026 14:47:28 +0200
+Subject: [PATCH 17/17] sysutils: disable _putenv_s() usage not available in
+ Windows XP
+
+We can use it when targetting UCRT.
+---
+ src/sysutils.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/sysutils.c b/src/sysutils.c
+index 2830452..022929a 100644
+--- a/src/sysutils.c
++++ b/src/sysutils.c
+@@ -144,7 +144,7 @@ _gpgrt_setenv (const char *name, const char *value, int overwrite)
+         if (!SetEnvironmentVariable (name, NULL))
+           return GPG_ERR_EINVAL;
+         if (getenv (name))
+-#if defined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
++#if defined(_UCRT)
+           {
+             int e = _putenv_s (name, "");
+ 
+@@ -176,7 +176,7 @@ _gpgrt_setenv (const char *name, const char *value, int overwrite)
+     if ((! exists || overwrite) && !SetEnvironmentVariable (name, value))
+       return GPG_ERR_EINVAL; /* (Might also be ENOMEM.) */
+     if (overwrite || !getenv (name))
+-#if defined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
++#if defined(_UCRT)
+       {
+         int e = _putenv_s (name, value);
+ 
+@@ -189,7 +189,7 @@ _gpgrt_setenv (const char *name, const char *value, int overwrite)
+ #else
+       {
+         /* Ugly: Leaking memory.  */
+-        buf = _gpgrt_strconcat (name, "=", value, NULL);
++        char *buf = _gpgrt_strconcat (name, "=", value, NULL);
+         if (!buf)
+           return _gpg_err_code_from_syserror ();
+         if (putenv (buf))
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/gpg-error/rules.mak
=====================================
@@ -34,6 +34,7 @@ libgpg-error: libgpg-error-$(GPGERROR_VERSION).tar.bz2 .sum-gpg-error
 	$(APPLY) $(SRC)/gpg-error/0015-core-disable-process-spawning-with-disable-threads.patch
 	$(APPLY) $(SRC)/gpg-error/0016-w32-utils-fix-init-utils-syntax.patch
 	$(APPLY) $(SRC)/gpg-error/0016-core-disable-registry-access-in-UWP.patch
+	$(APPLY) $(SRC)/gpg-error/0017-sysutils-disable-_putenv_s-usage-not-available-in-Wi.patch
 	# use the ANSI version of Environment API's as the rest of the code
 	sed -i.orig -e 's/ExpandEnvironmentStrings /ExpandEnvironmentStringsA /g' $(UNPACK_DIR)/src/w32-reg.c
 	sed -i.orig -e 's/SetEnvironmentVariable /SetEnvironmentVariableA /g' $(UNPACK_DIR)/src/sysutils.c



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f8304cd9c1addf5e059c0416d54f9d3ac2c48281

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f8304cd9c1addf5e059c0416d54f9d3ac2c48281
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list