PERFORCE change 90056 for review

Robert Watson rwatson at FreeBSD.org
Sat Jan 21 11:53:48 GMT 2006


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

Change 90056 by rwatson at rwatson_sesame on 2006/01/21 11:53:37

	Avoid variable aliasing by not allowing configurable delimiters
	for user entries.
	
	Submitted by:	phk
	Found by:	FlexeLint

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_user.c#11 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_user.c#11 (text+ko) ====

@@ -39,9 +39,9 @@
  * Parse the contents of the audit_user file into au_user_ent structures.
  */
 
-static FILE	*fp = NULL;
-static char	linestr[AU_LINE_MAX];
-static char	*delim = ":";
+static FILE		*fp = NULL;
+static char		 linestr[AU_LINE_MAX];
+static const char	*user_delim = ":";
 
 static pthread_mutex_t	mutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -49,14 +49,14 @@
  * Parse one line from the audit_user file into the au_user_ent structure.
  */
 static struct au_user_ent *
-userfromstr(char *str, char *delim, struct au_user_ent *u)
+userfromstr(char *str, struct au_user_ent *u)
 {
 	char *username, *always, *never;
 	char *last;
 
-	username = strtok_r(str, delim, &last);
-	always = strtok_r(NULL, delim, &last);
-	never = strtok_r(NULL, delim, &last);
+	username = strtok_r(str, user_delim, &last);
+	always = strtok_r(NULL, user_delim, &last);
+	never = strtok_r(NULL, user_delim, &last);
 
 	if ((username == NULL) || (always == NULL) || (never == NULL))
 		return (NULL);
@@ -128,7 +128,7 @@
 		*nl = '\0';
 
 	/* Get the next structure. */
-	if (userfromstr(linestr, delim, u) == NULL)
+	if (userfromstr(linestr, u) == NULL)
 		return (NULL);
 
 	return (u);
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