Discards long ACL lines

This commit is contained in:
Timothy Qiu
2017-08-09 15:53:58 -07:00
committed by Max Lv
parent 3f81ab3169
commit 32466ed51b
+17
View File
@@ -191,6 +191,23 @@ init_acl(const char *path)
char buf[257];
while (!feof(f))
if (fgets(buf, 256, f)) {
// Discards the whole line if longer than 255 characters
int long_line = 0; // 1: Long 2: Error
while ((strlen(buf) == 255) && (buf[254] != '\n')) {
long_line = 1;
LOGE("Discarding long ACL content: %s", buf);
if (fgets(buf, 256, f) == NULL) {
long_line = 2;
break;
}
}
if (long_line) {
if (long_line == 1) {
LOGE("Discarding long ACL content: %s", buf);
}
continue;
}
// Trim the newline
int len = strlen(buf);
if (len > 0 && buf[len - 1] == '\n') {