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>
dev
Bryce Harrington 8 years ago
parent f6051cbab8
commit 9c09fe70c7
  1. 7
      clients/multi-resource.c

@ -434,12 +434,13 @@ create_device(struct display *display, const char *time_desc, int type)
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;

Loading…
Cancel
Save