[launchd-changes] [23381] trunk/launchd/src/launchd_core_logic.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 13 12:11:36 PDT 2007


Revision: 23381
          http://trac.macosforge.org/projects/launchd/changeset/23381
Author:   zarzycki at apple.com
Date:     2007-09-13 12:11:36 -0700 (Thu, 13 Sep 2007)

Log Message:
-----------
Better input vetting.

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

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2007-09-13 17:54:03 UTC (rev 23380)
+++ trunk/launchd/src/launchd_core_logic.c	2007-09-13 19:11:36 UTC (rev 23381)
@@ -1687,6 +1687,7 @@
 	job_t j;
 
 	if (pload == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 
@@ -1695,14 +1696,21 @@
 		return NULL;
 	}
 
-	if ((tmp = launch_data_dict_lookup(pload, LAUNCH_JOBKEY_LABEL)) &&
-			(launch_data_get_type(tmp) == LAUNCH_DATA_STRING)) {
-		if (!(label = launch_data_get_string(tmp))) {
-			errno = EINVAL;
-			return NULL;
-		}
+	if (!(tmp = launch_data_dict_lookup(pload, LAUNCH_JOBKEY_LABEL))) {
+		errno = EINVAL;
+		return NULL;
 	}
 
+	if (launch_data_get_type(tmp) != LAUNCH_DATA_STRING) {
+		errno = EINVAL;
+		return NULL;
+	}
+
+	if (!(label = launch_data_get_string(tmp))) {
+		errno = EINVAL;
+		return NULL;
+	}
+
 	if ((tmp = launch_data_dict_lookup(pload, LAUNCH_JOBKEY_PROGRAM)) &&
 			(launch_data_get_type(tmp) == LAUNCH_DATA_STRING)) {
 		prog = launch_data_get_string(tmp);

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


More information about the launchd-changes mailing list