From: Srivardhan Hebbar Date: Mon, 6 Oct 2014 13:12:38 +0000 (-0400) Subject: ecore_drm: Verifying if name format is /dev/xyz before assigning to tty. X-Git-Tag: v1.12.0-alpha1~96 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ebc31908e7ac81a8f6ce0979a40ba7865a5bf48;p=platform%2Fupstream%2Fefl.git ecore_drm: Verifying if name format is /dev/xyz before assigning to tty. 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 Reviewers: devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1521 --- diff --git a/src/lib/ecore_drm/ecore_drm_tty.c b/src/lib/ecore_drm/ecore_drm_tty.c index c047494311..c6246985e7 100644 --- a/src/lib/ecore_drm/ecore_drm_tty.c +++ b/src/lib/ecore_drm/ecore_drm_tty.c @@ -205,8 +205,13 @@ ecore_drm_tty_open(Ecore_Drm_Device *dev, const char *name) 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) {