aboutsummaryrefslogtreecommitdiffstats
path: root/libbsm/bsm_control.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbsm/bsm_control.c')
-rw-r--r--libbsm/bsm_control.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libbsm/bsm_control.c b/libbsm/bsm_control.c
index a58db0ef6ea4..378035db729e 100644
--- a/libbsm/bsm_control.c
+++ b/libbsm/bsm_control.c
@@ -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 @@ getstrfromtype_locked(char *name, char **str)
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) {