From 69df60bd6622a56200d2d03e1b7d899569adf650 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Wed, 14 Dec 2016 11:17:47 +0100 Subject: [PATCH] wgt-info: Enforce lower case ids and version MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This will be used next to avoid faking identity of applications using the case difference. Change-Id: I13cbdd5124b58b2a72c15054df6f3cd0e11a2cc5 Signed-off-by: José Bollo --- src/wgt-info.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/wgt-info.c b/src/wgt-info.c index c8308fa..089a563 100644 --- a/src/wgt-info.c +++ b/src/wgt-info.c @@ -20,6 +20,7 @@ #include #include #include +#include #include @@ -117,6 +118,16 @@ static char *mkidaver(char *id, char *ver) return NULL; } +static void make_lowercase(char *s) +{ + if (s) { + while(*s) { + *s = (char)tolower(*s); + s++; + } + } +} + static int fill_desc(struct wgt_desc *desc, int want_icons, int want_features, int want_preferences) { xmlNodePtr node, pnode; @@ -132,8 +143,10 @@ static int fill_desc(struct wgt_desc *desc, int want_icons, int want_features, i return -1; } desc->id = xmlGetProp(node, wgt_config_string_id); + make_lowercase(desc->id); desc->version = xmlGetProp(node, wgt_config_string_version); desc->ver = mkver(desc->version); + make_lowercase(desc->ver); desc->idaver = mkidaver(desc->id, desc->ver); desc->width = getpropnum(node, wgt_config_string_width, 0); desc->height = getpropnum(node, wgt_config_string_height, 0); -- 2.16.6