aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-06-02 02:31:18 +0100
committerMatthew Wild <mwild1@gmail.com>2011-06-02 02:31:18 +0100
commit3415a3da2add388452f19386d7b37bffec49a2a7 (patch)
tree5c18192e6e617619650e72e269b8fd1077770a69 /util
parentdc3512261a38f142b2c6d19b398f13dbb2af1f52 (diff)
parent7037ff8b95c6d1860b1ca9e42a9916ac237419cc (diff)
downloadprosody-3415a3da2add388452f19386d7b37bffec49a2a7.tar.gz
prosody-3415a3da2add388452f19386d7b37bffec49a2a7.zip
Merge 0.8->trunk
Diffstat (limited to 'util')
-rw-r--r--util/json.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/json.lua b/util/json.lua
index 05453703..cfa84a4b 100644
--- a/util/json.lua
+++ b/util/json.lua
@@ -134,12 +134,14 @@ end
function json.decode(json)
+ json = json.." "; -- appending a space ensures valid json wouldn't touch EOF
local pos = 1;
local current = {};
local stack = {};
local ch, peek;
local function next()
ch = json:sub(pos, pos);
+ if ch == "" then error("Unexpected EOF"); end
pos = pos+1;
peek = json:sub(pos, pos);
return ch;