Change in libosmocore[master]: exec: prevent uninitialized memory access in osmo_system_nowait()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Sat Feb 8 22:07:05 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/17110 )


Change subject: exec: prevent uninitialized memory access in osmo_system_nowait()
......................................................................

exec: prevent uninitialized memory access in osmo_system_nowait()

If (!env_whitelist && addl_env), osmo_environment_append() would
access uninitialized memory. If both are false, execle() would
also deal with garbage values. Let's ensure that at least the
first element of new_env[] is initialized.

Change-Id: Id3901de4692ef44e9e9c67b1804e027fc4ce7c18
Fixes: CID#206571
---
M src/exec.c
1 file changed, 3 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/10/17110/1

diff --git a/src/exec.c b/src/exec.c
index a9d8ce0..b806ad5 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -217,6 +217,9 @@
 		/* close all file descriptors above stdio */
 		osmo_close_all_fds_above(2);
 
+		/* man execle: "an array of pointers *must* be terminated by a null pointer" */
+		new_env[0] = NULL;
+
 		/* build the new environment */
 		if (env_whitelist)
 			osmo_environment_filter(new_env, ARRAY_SIZE(new_env), environ, env_whitelist);

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/17110
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id3901de4692ef44e9e9c67b1804e027fc4ce7c18
Gerrit-Change-Number: 17110
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200208/c1302d91/attachment.htm>


More information about the gerrit-log mailing list