summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_tty.c
diff options
context:
space:
mode:
authorSrivardhan Hebbar <sri.hebbar@samsung.com>2014-10-06 09:12:38 -0400
committerChris Michael <cp.michael@samsung.com>2014-10-06 09:14:30 -0400
commit5ebc31908e7ac81a8f6ce0979a40ba7865a5bf48 (patch)
tree72ab8dee3d6eeb828ade3d96012a65b1d118aaf7 /src/lib/ecore_drm/ecore_drm_tty.c
parent7f2815b014b41a6dd190f5f46b366f834e151409 (diff)
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 <sri.hebbar@samsung.com> Reviewers: devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1521
Diffstat (limited to 'src/lib/ecore_drm/ecore_drm_tty.c')
-rw-r--r--src/lib/ecore_drm/ecore_drm_tty.c9
1 files 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 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)
205 else 205 else
206 dev->tty.fd = dup(STDIN_FILENO); 206 dev->tty.fd = dup(STDIN_FILENO);
207 } 207 }
208 else // FIXME: NB: This should Really check for format of name (/dev/xyz) 208 else
209 snprintf(tty, sizeof(tty), "%s", name); 209 {
210 if (strncmp(name,"/dev/", 5))
211 snprintf(tty, sizeof(tty), "/dev/%s",name);
212 else
213 snprintf(tty, sizeof(tty), "%s", name);
214 }
210 215
211 if (dev->tty.fd < 0) 216 if (dev->tty.fd < 0)
212 { 217 {