PERFORCE change 90077 for review

Robert Watson rwatson at FreeBSD.org
Sat Jan 21 13:54:44 GMT 2006


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

Change 90077 by rwatson at rwatson_sesame on 2006/01/21 13:53:51

	More avoidance of hand-calculated token sizes.
	
	Submitted by:	phk
	Found with:	FlexeLint

Affected files ...

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

Differences ...

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

@@ -151,8 +151,8 @@
 	u_int16_t pad0_16 = 0;
 	u_int16_t pad0_32 = 0;
 
-	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));
+	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)
 		return (NULL);
 
@@ -296,7 +296,8 @@
 	u_char *dptr = NULL;
 	int i;
 
-	GET_TOKEN_AREA(t, dptr, n * 4 + 3);
+	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) +
+	    n * sizeof(u_int32_t));
 	if (t == NULL)
 		return (NULL);
 
@@ -318,7 +319,7 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	GET_TOKEN_AREA(t, dptr, 5);
+	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int32_t));
 	if (t == NULL)
 		return (NULL);
 
@@ -340,7 +341,7 @@
 	u_char *dptr = NULL;
 	u_int32_t type = AF_INET6;
 
-	GET_TOKEN_AREA(t, dptr, 21);
+	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 5 * sizeof(u_int32_t));
 	if (t == NULL)
 		return (NULL);
 
@@ -389,7 +390,7 @@
 	u_char *dptr = NULL;
 
 
-	GET_TOKEN_AREA(t, dptr, 6);
+	GET_TOKEN_AREA(t, dptr, 2 * sizeof(u_char) + sizeof(u_int32_t));
 	if (t == NULL)
 		return (NULL);
 
@@ -450,7 +451,6 @@
 	return (t);
 }
 
-
 /*
  * token ID                1 byte
  * port IP address         2 bytes
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list