r20640: Commit part 2/2
[metze/samba/wip.git] / source4 / heimdal / lib / krb5 / config_file.c
index 66051303ed8b5d62938eba318f35e73d527e42ac..bbd9cf4c781550f5aa3e07954c3a75e6213c2841 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 #include "krb5_locl.h"
-RCSID("$Id: config_file.c,v 1.54 2006/04/02 00:59:19 lha Exp $");
+RCSID("$Id: config_file.c,v 1.55 2006/12/04 23:35:54 lha Exp $");
 
 #ifndef HAVE_NETINFO
 
@@ -158,8 +158,7 @@ parse_list(struct fileptr *f, unsigned *lineno, krb5_config_binding **parent,
        char *p;
 
        ++*lineno;
-       if (buf[strlen(buf) - 1] == '\n')
-           buf[strlen(buf) - 1] = '\0';
+       buf[strcspn(buf, "\r\n")] = '\0';
        p = buf;
        while(isspace((unsigned char)*p))
            ++p;
@@ -255,8 +254,7 @@ krb5_config_parse_debug (struct fileptr *f,
        char *p;
 
        ++*lineno;
-       if(buf[strlen(buf) - 1] == '\n')
-           buf[strlen(buf) - 1] = '\0';
+       buf[strcspn(buf, "\r\n")] = '\0';
        p = buf;
        while(isspace((unsigned char)*p))
            ++p;