PERFORCE change 90070 for review

Robert Watson rwatson at FreeBSD.org
Sat Jan 21 05:13:53 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=90070

Change 90070 by rwatson at rwatson_sesame on 2006/01/21 13:12:53

	Be less tolerant of NULL pointer arguments to token generation
	functions: Solaris will core dump apps that try this, and it adds
	significant complexity for cases not actually supported by the
	API.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#25 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#25 (text+ko) ====

@@ -83,11 +83,6 @@
 	u_char *dptr = NULL;
 	u_int16_t textlen;
 
-	if (text == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	textlen = strlen(text);
 	textlen += 1;
 
@@ -113,11 +108,6 @@
 	u_char *dptr = NULL;
 	u_int16_t textlen;
 
-	if (text == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	textlen = strlen(text);
 	textlen += 1;
 
@@ -161,11 +151,6 @@
 	u_int16_t pad0_16 = 0;
 	u_int16_t pad0_32 = 0;
 
-	if (vni == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 2*sizeof(u_int16_t) +
 	    3*sizeof(u_int32_t) + sizeof(u_int64_t) + sizeof(u_int32_t));
 	if (t == NULL)
@@ -233,11 +218,6 @@
 	u_char *dptr = NULL;
 	size_t datasize, totdata;
 
-	if (p == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	/* Determine the size of the basic unit. */
 	switch (unit_type) {
 	case AUR_BYTE:
@@ -316,11 +296,6 @@
 	u_char *dptr = NULL;
 	int i;
 
-	if (groups == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, n * 4 + 3);
 	if (t == NULL)
 		return (NULL);
@@ -343,11 +318,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if (internet_addr == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, 5);
 	if (t == NULL)
 		return (NULL);
@@ -370,11 +340,6 @@
 	u_char *dptr = NULL;
 	u_int32_t type = AF_INET6;
 
-	if (internet_addr == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, 21);
 	if (t == NULL)
 		return (NULL);
@@ -399,11 +364,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if (ip == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(struct ip));
 	if (t == NULL)
 		return (NULL);
@@ -457,12 +417,6 @@
 	u_char *dptr = NULL;
 	u_int16_t pad0 = 0;
 
-
-	if (perm == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, 12 * sizeof(u_int16_t) + sizeof(u_int32_t));
 	if (t == NULL)
 		return (NULL);
@@ -507,7 +461,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t));
 	if (t == NULL)
 		return (NULL);
@@ -530,11 +483,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if (data == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) + bytes);
 	if (t == NULL)
 		return (NULL);
@@ -572,10 +520,6 @@
 		return (NULL);
 #endif
 
-	if (file == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
 	filelen = strlen(file);
 	filelen += 1;
 
@@ -607,10 +551,6 @@
 	u_char *dptr = NULL;
 	u_int16_t textlen;
 
-	if (text == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
 	textlen = strlen(text);
 	textlen += 1;
 
@@ -637,10 +577,6 @@
 	u_char *dptr = NULL;
 	u_int16_t textlen;
 
-	if (text == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
 	textlen = strlen(text);
 	textlen += 1;
 
@@ -675,11 +611,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if (tid == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 9 * sizeof(u_int32_t));
 	if (t == NULL)
 		return (NULL);
@@ -737,11 +668,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if (tid == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 13 * sizeof(u_int32_t));
 	if (t == NULL)
 		return (NULL);
@@ -903,9 +829,6 @@
 	token_t *t;
 	u_char *dptr;
 
-	if (so == NULL)
-		return (NULL);
-
 	GET_TOKEN_AREA(t, dptr, 3 * sizeof(u_char) + strlen(so->sun_path) + 1);
 	if (t == NULL)
 		return (NULL);
@@ -931,11 +854,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if (so == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, 3 * sizeof(u_char) + sizeof(u_int16_t) +
 	    sizeof(u_int32_t));
 	if (t == NULL)
@@ -961,11 +879,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if (so == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, 3 * sizeof(u_char) + sizeof(u_int16_t) +
 	    4 * sizeof(u_int32_t));
 	if (t == NULL)
@@ -1016,11 +929,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if (tid == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 9 * sizeof(u_int32_t));
 	if (t == NULL)
 		return (NULL);
@@ -1078,11 +986,6 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if (tid == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 13 * sizeof(u_int32_t));
 	if (t == NULL)
 		return (NULL);
@@ -1155,11 +1058,6 @@
 	int i, count = 0;
 	size_t totlen = 0;
 
-	if (args == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	nextarg = *args;
 
 	while (nextarg != NULL) {
@@ -1201,11 +1099,6 @@
 	size_t totlen = 0;
 	const char *nextenv;
 
-	if (env == NULL) {
-		errno = EINVAL;
-		return (NULL);
-	}
-
 	nextenv = *env;
 
 	while (nextenv != NULL) {


More information about the p4-projects mailing list