mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
modules/lua_utils.lua: enforce checks on version before doing ariths
This commit lets the version2int() function better check types and convertibility before performing arithmetics to get the version hash.
This commit is contained in:
parent
9c0364d385
commit
2aac293316
1 changed files with 3 additions and 3 deletions
|
|
@ -1090,9 +1090,9 @@ function version2int(v)
|
|||
minor = e[2]
|
||||
veryminor = e[3]
|
||||
|
||||
if(major == nil or type(major) ~= "string") then major = 0 end
|
||||
if(minor == nil or type(minor) ~= "string") then minor = 0 end
|
||||
if(veryminor == nil or type(veryminor) ~= "string") then veryminor = 0 end
|
||||
if(major == nil or tonumber(major) == nil or type(major) ~= "string") then major = 0 end
|
||||
if(minor == nil or tonumber(minor) == nil or type(minor) ~= "string") then minor = 0 end
|
||||
if(veryminor == nil or tonumber(veryminor) == nil or type(veryminor) ~= "string") then veryminor = 0 end
|
||||
|
||||
version = tonumber(major)*1000 + tonumber(minor)*100 + tonumber(veryminor)
|
||||
return(version)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue