devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=5ebc31908e7ac81a8f6ce0979a40ba7865a5bf48

commit 5ebc31908e7ac81a8f6ce0979a40ba7865a5bf48
Author: Srivardhan Hebbar <[email protected]>
Date:   Mon Oct 6 09:12:38 2014 -0400

    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 <[email protected]>
    
    Reviewers: devilhorns
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D1521
---
 src/lib/ecore_drm/ecore_drm_tty.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_drm/ecore_drm_tty.c 
b/src/lib/ecore_drm/ecore_drm_tty.c
index c047494..c624698 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)
      {

-- 


Reply via email to