[launchd-changes] [23273] trunk/launchd/src/launchctl.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Jun 6 09:04:52 PDT 2007


Revision: 23273
          http://trac.macosforge.org/projects/launchd/changeset/23273
Author:   zarzycki at apple.com
Date:     2007-06-06 09:04:51 -0700 (Wed, 06 Jun 2007)

Log Message:
-----------
<rdar://problem/5253449> launchctl:do_sysversion_sysctl() does not have any safety checks

Modified Paths:
--------------
    trunk/launchd/src/launchctl.c

Modified: trunk/launchd/src/launchctl.c
===================================================================
--- trunk/launchd/src/launchctl.c	2007-06-04 18:26:07 UTC (rev 23272)
+++ trunk/launchd/src/launchctl.c	2007-06-06 16:04:51 UTC (rev 23273)
@@ -2887,12 +2887,14 @@
 		return;
 	}
 
-	versdict = _CFCopySystemVersionDictionary();
-	buildvers = CFDictionaryGetValue(versdict, _kCFSystemVersionBuildVersionKey);
-	CFStringGetCString(buildvers, buf, sizeof(buf), kCFStringEncodingUTF8);
+	if (!assumes((versdict = _CFCopySystemVersionDictionary()))) {
+		return;
+	}
 
-	if (sysctl(mib, 2, NULL, 0, buf, strlen(buf) + 1) == -1) {
-		fprintf(stderr, "sysctl(): %s\n", strerror(errno));
+	if (assumes((buildvers = CFDictionaryGetValue(versdict, _kCFSystemVersionBuildVersionKey)))) {
+		CFStringGetCString(buildvers, buf, sizeof(buf), kCFStringEncodingUTF8);
+
+		assumes(sysctl(mib, 2, NULL, 0, buf, strlen(buf) + 1) != -1);
 	}
 
 	CFRelease(versdict);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070606/cad7d433/attachment.html


More information about the launchd-changes mailing list