Revision
23101
Author
zarzycki@apple.com
Date
2007-02-22 16:43:05 -0800 (Thu, 22 Feb 2007)

Log Message

<rdar://problem/4918402> 64-bit daemon fails to connect to launchd

Modified Paths

Diff

Modified: trunk/launchd/src/liblaunch.c (23100 => 23101)


--- trunk/launchd/src/liblaunch.c	2007-02-22 23:38:57 UTC (rev 23100)
+++ trunk/launchd/src/liblaunch.c	2007-02-23 00:43:05 UTC (rev 23101)
@@ -623,9 +623,9 @@
 	case LAUNCH_DATA_DICTIONARY:
 	case LAUNCH_DATA_ARRAY:
 		o_in_w->_array_cnt = host2big(d->_array_cnt);
-		*where = realloc(*where, *len + (d->_array_cnt * sizeof(launch_data_t)));
-		memcpy(*where + *len, d->_array, d->_array_cnt * sizeof(launch_data_t));
-		*len += d->_array_cnt * sizeof(launch_data_t);
+		*where = realloc(*where, *len + (d->_array_cnt * sizeof(uint64_t)));
+		memset(*where + *len, 0, d->_array_cnt * sizeof(uint64_t));
+		*len += d->_array_cnt * sizeof(uint64_t);
 
 		for (i = 0; i < d->_array_cnt; i++)
 			launch_data_pack(d->_array[i], where, len, fd_where, fdcnt);
@@ -649,12 +649,12 @@
 	case LAUNCH_DATA_DICTIONARY:
 	case LAUNCH_DATA_ARRAY:
 		tmpcnt = big2host(r->_array_cnt);
-		if ((conn->recvlen - *data_offset) < (tmpcnt * sizeof(launch_data_t))) {
+		if ((conn->recvlen - *data_offset) < (tmpcnt * sizeof(uint64_t))) {
 			errno = EAGAIN;
 			return NULL;
 		}
 		r->_array = conn->recvbuf + *data_offset;
-		*data_offset += tmpcnt * sizeof(launch_data_t);
+		*data_offset += tmpcnt * sizeof(uint64_t);
 		for (i = 0; i < tmpcnt; i++) {
 			r->_array[i] = launch_data_unpack(conn, data_offset, fdoffset);
 			if (r->_array[i] == NULL)