From: Tobias Ulmer Date: Tue, 15 Apr 2014 14:49:37 +0000 (+0200) Subject: Fix crash on invalid src.licences data type X-Git-Tag: e2factory-2.3.15rc1~209 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=e29cda7d304e24bce3ebd3c9721cd42baab3e8b4;p=e2factory.git Fix crash on invalid src.licences data type Signed-off-by: Tobias Ulmer --- diff --git a/local/scm.lua b/local/scm.lua index 03b3551..43b9968 100644 --- a/local/scm.lua +++ b/local/scm.lua @@ -156,7 +156,7 @@ local function source_apply_default_licences(info, sourcename) " licence attribute is deprecated. Replace by licences.") src.licences = src.licence end - if not src.licences then + if src.licences == nil then e2lib.warnf("WDEFAULT", "in source %s:", src.name) e2lib.warnf("WDEFAULT", " licences attribute missing. Defaulting to empty list.") @@ -167,6 +167,12 @@ local function source_apply_default_licences(info, sourcename) " licences attribute is not in table format. Converting.") src.licences = { src.licences } end + + if type(src.licences) ~= "table" then + e:append("licences attribute is of invalid type") + return false, e + end + for i, s in pairs(src.licences) do if type(i) ~= "number" or type(s) ~= "string" then e:append("licences attribute is not a list of strings")