Use strcspn to convert the newline to NUL in fgets results.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11462 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -88,9 +88,7 @@ krb5_kuserok (krb5_context context,
|
||||
while (fgets (buf, sizeof(buf), f) != NULL) {
|
||||
krb5_principal tmp;
|
||||
|
||||
if(buf[strlen(buf) - 1] == '\n')
|
||||
buf[strlen(buf) - 1] = '\0';
|
||||
|
||||
buf[strcspn(buf, "\n")] = '\0';
|
||||
ret = krb5_parse_name (context, buf, &tmp);
|
||||
if (ret) {
|
||||
fclose (f);
|
||||
|
Reference in New Issue
Block a user