summaryrefslogtreecommitdiff
path: root/libarchive/archive_acl.c
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2018-09-09 20:31:59 +0200
committerJoerg Sonnenberger <joerg@bec.de>2018-09-09 20:31:59 +0200
commit0cda60af13e709e670af90553b2271bf194e7ccd (patch)
treee2bbb243e80e89a1aeb444934c75363e4be32edc /libarchive/archive_acl.c
parent506ae424124945eea11f09251e2e78796fb2f86e (diff)
downloadlibarchive-0cda60af13e709e670af90553b2271bf194e7ccd.tar.gz
Handle whitespace-only ACL fields correctly.
The logic would result in possible reads before the start of a buffer. Reported-By: OSS-Fuzz issue 10192
Diffstat (limited to 'libarchive/archive_acl.c')
-rw-r--r--libarchive/archive_acl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libarchive/archive_acl.c b/libarchive/archive_acl.c
index 4736531a..9941d2f6 100644
--- a/libarchive/archive_acl.c
+++ b/libarchive/archive_acl.c
@@ -2058,6 +2058,12 @@ next_field(const char **p, const char **start,
}
*sep = **p;
+ /* If the field is only whitespace, bail out now. */
+ if (**p == '\0') {
+ *end = *p;
+ return;
+ }
+
/* Trim trailing whitespace to locate end of field. */
*end = *p - 1;
while (**end == ' ' || **end == '\t' || **end == '\n') {