From a4135d32340a5a6cca7a10cc797cafda5451f982 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen Date: Tue, 24 Mar 2015 23:37:48 +0100 Subject: tmpfiles: avoid out of bounds read Otherwise this will go wrong for 'v'. --- src/tmpfiles/tmpfiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tmpfiles/tmpfiles.c') diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 25c8cfa694..55a6a7bb54 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; } -- cgit v1.2.3