[darwinbuild-changes] [1021] branches/PR-10827653/darwintrace/darwintrace.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 15 10:58:47 PST 2012
Revision: 1021
http://trac.macosforge.org/projects/darwinbuild/changeset/1021
Author: kvv at apple.com
Date: 2012-02-15 10:58:47 -0800 (Wed, 15 Feb 2012)
Log Message:
-----------
- posix_spawn may have NULL envp parameter
Modified Paths:
--------------
branches/PR-10827653/darwintrace/darwintrace.c
Modified: branches/PR-10827653/darwintrace/darwintrace.c
===================================================================
--- branches/PR-10827653/darwintrace/darwintrace.c 2012-02-15 18:50:01 UTC (rev 1020)
+++ branches/PR-10827653/darwintrace/darwintrace.c 2012-02-15 18:58:47 UTC (rev 1021)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005-2011 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2012 Apple Inc. All rights reserved.
*
* @APPLE_BSD_LICENSE_HEADER_START@
*
@@ -393,11 +393,13 @@
int count = 0;
/* count the environment variables */
- while (envp[count] != NULL) {
- if (has_prefix(envp[count], DYLD_INSERT_LIBRARIES)) {
- libs = envp[count] + strlen(DYLD_INSERT_LIBRARIES);
+ if (envp) {
+ while (envp[count] != NULL) {
+ if (has_prefix(envp[count], DYLD_INSERT_LIBRARIES)) {
+ libs = envp[count] + strlen(DYLD_INSERT_LIBRARIES);
+ }
+ ++count;
}
- ++count;
}
/* allocate size of envp with enough space for three more values and NULL */
@@ -435,7 +437,9 @@
}
++i;
- memcpy(&result[i], envp, count * sizeof(char *));
+ if (envp) {
+ memcpy(&result[i], envp, count * sizeof(char *));
+ }
while (result[i] != NULL) {
if (has_prefix(result[i], DARWINTRACE_IGNORE_ROOTS) ||
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20120215/80e16c97/attachment-0001.html>
More information about the darwinbuild-changes
mailing list