multi-resource: Check for no digits in time description
strtoul(nptr, endptr, ...) will set *endptr to nptr in the case of where
no digits were read from the string. E.g. "foo:bar" should trigger an
error, instead of being read as "0:0" and allowed through.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
diff --git a/clients/multi-resource.c b/clients/multi-resource.c
index c283022..2fca7c3 100644
--- a/clients/multi-resource.c
+++ b/clients/multi-resource.c
@@ -434,12 +434,13 @@
errno = 0;
start_time = strtoul(time_desc, &tail, 10);
- if (errno)
+ if (errno || tail == time_desc)
goto error;
if (*tail == ':') {
- end_time = strtoul(tail + 1, &tail, 10);
- if (errno || *tail != '\0')
+ time_desc = tail + 1;
+ end_time = strtoul(time_desc, &tail, 10);
+ if (errno || tail == time_desc || *tail != '\0')
goto error;
} else if (*tail != '\0') {
goto error;