From: Sam Hartman Date: Wed, 14 Jun 1995 22:27:37 +0000 (+0000) Subject: Fixed ACL routines to work on systems with unsigned char. X-Git-Tag: krb5-1.0-beta6~1748 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=041c06b9a7871bee25c315b207c6f7093d81e505;p=krb5.git Fixed ACL routines to work on systems with unsigned char. Also fixed minor ordering problem in error checks. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6063 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/v5server/ChangeLog b/src/kadmin/v5server/ChangeLog index 2dbae7792..c2cb92393 100644 --- a/src/kadmin/v5server/ChangeLog +++ b/src/kadmin/v5server/ChangeLog @@ -1,3 +1,15 @@ +Wed Jun 14 17:19:09 1995 Sam Hartman + + * srv_acl.c (acl_get_line): Check to make sure we haven't exceeded + the buffer size before overwriting the newline we may have just + read. If the newline is clobbered, there is no way of + distinguishing between a line that uses the full buffer from a + line longer than the full buffer. Also, cast EOF to a char, so + that it works on unsigned char systems. This means you can't + distinguish reading 0xff at the beginning of a line from EOF, but + the only other option is to introduce an intermediate variable. + + Tue Jun 13 11:36:52 1995 Sam Hartman * srv_net.c: Include sys/select.h if it is found. diff --git a/src/kadmin/v5server/srv_acl.c b/src/kadmin/v5server/srv_acl.c index 4b1cf4d61..fae8e5a9a 100644 --- a/src/kadmin/v5server/srv_acl.c +++ b/src/kadmin/v5server/srv_acl.c @@ -96,14 +96,14 @@ acl_get_line(fp, lnp) (!feof(fp)) && ((acl_buf[i] = fgetc(fp)) != '\n')); i++); - acl_buf[i] = '\0'; /* Check if we exceeded our buffer size */ if ((i == BUFSIZ) && (!feof(fp)) && (acl_buf[i] != '\n')) { fprintf(stderr, acl_line2long_msg, acl_acl_file, *lnp); while (fgetc(fp) != '\n'); } - if (acl_buf[0] == EOF) /* ptooey */ + acl_buf[i] = '\0'; + if (acl_buf[0] == (char) EOF) /* ptooey */ acl_buf[0] = '\0'; else (*lnp)++;