From 8dcd638829ce0089f969bd7f6914683cb747b624 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Wed, 4 Sep 2019 20:09:41 +0100 Subject: [PATCH] Efreet_Uri: fix URI decoding when a Windows path (letter followed by :) is passed to efreet_uri_decode() Summary: uri decoding returned a wrong URI when a Windows path is given Test Plan: rage, which is using efreet_uri is now playing files on Windows Reviewers: raster, cedric, zmike, stefan_schmidt Reviewed By: raster Subscribers: stefan_schmidt, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9839 --- src/lib/efreet/efreet_uri.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/efreet/efreet_uri.c b/src/lib/efreet/efreet_uri.c index 9f468ce5df..44fe54a35f 100644 --- a/src/lib/efreet/efreet_uri.c +++ b/src/lib/efreet/efreet_uri.c @@ -22,13 +22,16 @@ efreet_uri_decode(const char *full_uri) Efreet_Uri *uri; const char *p; char scheme[64], authority[_POSIX_HOST_NAME_MAX], path[PATH_MAX]; + char *sep; int i = 0; EINA_SAFETY_ON_NULL_RETURN_VAL(full_uri, NULL); /* An uri should be in the form :[][][][] */ - if (!strstr(full_uri, ":")) return NULL; - + sep = strchr(full_uri, ':'); + if (!sep) return NULL; + /* check if we have a Windows PATH, that is a letter follow by a colon */ + if ((sep - full_uri) == 1) return NULL; memset(scheme, 0, 64); memset(authority, 0, _POSIX_HOST_NAME_MAX);