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>
This commit is contained in:
@@ -434,12 +434,13 @@ create_device(struct display *display, const char *time_desc, int type)
|
|||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
start_time = strtoul(time_desc, &tail, 10);
|
start_time = strtoul(time_desc, &tail, 10);
|
||||||
if (errno)
|
if (errno || tail == time_desc)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (*tail == ':') {
|
if (*tail == ':') {
|
||||||
end_time = strtoul(tail + 1, &tail, 10);
|
time_desc = tail + 1;
|
||||||
if (errno || *tail != '\0')
|
end_time = strtoul(time_desc, &tail, 10);
|
||||||
|
if (errno || tail == time_desc || *tail != '\0')
|
||||||
goto error;
|
goto error;
|
||||||
} else if (*tail != '\0') {
|
} else if (*tail != '\0') {
|
||||||
goto error;
|
goto error;
|
||||||
|
|||||||
Reference in New Issue
Block a user