Date: Sat, 21 Jan 2006 11:53:48 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 90056 for review Message-ID: <200601211153.k0LBrmiZ068989@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=90056 Change 90056 by rwatson@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601211153.k0LBrmiZ068989>