|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: package/.../musl/0005-env-avoid-leaving-dangling-pointers-in-__env_map.patch
|
|
# Copyright (C) 2016 The OpenSDE Project
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# This patch file is dual-licensed. It is available under the license the
|
|
# patched project is licensed under, as long as it is an OpenSource license
|
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
|
# of the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 2 of the License, or (at your option) any later
|
|
# version.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
From 9543656cc32fda48fc463f332ee20e91eed2b768 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Monakov <amonakov@ispras.ru>
|
|
Date: Sun, 6 Mar 2016 20:22:38 +0300
|
|
Subject: [PATCH] env: avoid leaving dangling pointers in __env_map
|
|
|
|
This is the minimal fix for __putenv leaving a pointer to freed heap
|
|
storage in __env_map array, which could later on lead to errors such
|
|
as double-free.
|
|
---
|
|
src/env/putenv.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/src/env/putenv.c b/src/env/putenv.c
|
|
index 4042869..7153042 100644
|
|
--- a/src/env/putenv.c
|
|
+++ b/src/env/putenv.c
|
|
@@ -30,6 +30,7 @@ int __putenv(char *s, int a)
|
|
}
|
|
} else {
|
|
free(__env_map[j]);
|
|
+ __env_map[j] = s;
|
|
}
|
|
}
|
|
}
|
|
--
|
|
2.7.2
|
|
|