Summary: Because this is an exposed API function, we should be
checking that the name parameter is valid, and also verify it's
formatting before we use it. This patch fixes that by comparing the
passed in name and assembling a valid tty name to open
@fix
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
Reviewers: devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1521
else
dev->tty.fd = dup(STDIN_FILENO);
}
- else // FIXME: NB: This should Really check for format of name (/dev/xyz)
- snprintf(tty, sizeof(tty), "%s", name);
+ else
+ {
+ if (strncmp(name,"/dev/", 5))
+ snprintf(tty, sizeof(tty), "/dev/%s",name);
+ else
+ snprintf(tty, sizeof(tty), "%s", name);
+ }
if (dev->tty.fd < 0)
{