From: Thomas Hindoe Paaboel Andersen Date: Tue, 24 Mar 2015 22:37:48 +0000 (+0100) Subject: tmpfiles: avoid out of bounds read X-Git-Tag: v219.0~235 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a4135d32340a5a6cca7a10cc797cafda5451f982;p=elogind.git tmpfiles: avoid out of bounds read Otherwise this will go wrong for 'v'. --- diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 25c8cfa69..55a6a7bb5 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -830,7 +830,7 @@ static int get_attrib_from_arg(Item *item) { return -EINVAL; } for (; *p ; p++) { - if ((uint8_t)*p > ELEMENTSOF(attributes) || attributes[(uint8_t)*p] == 0) { + if ((uint8_t)*p >= ELEMENTSOF(attributes) || attributes[(uint8_t)*p] == 0) { log_error("\"%s\": setting ATTR: unknown attr '%c'", item->path, *p); return -EINVAL; }