Date: Tue, 23 Jun 2009 22:39:20 GMT From: Stacey Son <sson@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 165010 for review Message-ID: <200906232239.n5NMdKgP079844@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=165010 Change 165010 by sson@sson_amd64 on 2009/06/23 22:38:28 Remove trailing white space when parsing audit_control. Trailing white space can cause problems with some fields such as 'dir' in the audit_control file. Besides removing the trailing new line we remove the trail white space as well. (Credit to Brooks Davis for finding this bug.) Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#34 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#34 (text+ko) ==== @@ -27,7 +27,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#33 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#34 $ */ #include <config/config.h> @@ -121,9 +121,13 @@ if (linestr[0] == '#') continue; - /* Remove trailing new line character. */ - if ((nl = strrchr(linestr, '\n')) != NULL) + /* Remove trailing new line character and white space. */ + nl = strchr(linestr, '\0') - 1; + while (nl >= linestr && ('\n' == *nl || ' ' == *nl || + '\t' == *nl)) { *nl = '\0'; + nl--; + } tokptr = linestr; if ((type = strtok_r(tokptr, delim, &last)) != NULL) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906232239.n5NMdKgP079844>