Use strcspn to remove \n from fgets result. Prompted by change by Ray
Lai of OpenBSD via Björn Sandell. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19213 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user