aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolderpunk <solderpunk@sdf.org>2018-12-08 17:05:23 +0000
committerSolderpunk <solderpunk@sdf.org>2018-12-08 17:05:23 +0000
commit783e1c7a52d57ee5393dcbceb1b5aec4c8bb3172 (patch)
treecb02815090354c7ce96a981f375762ffec4866c0
parentHave main command loop and the type command 'subshell' share the same dispatc... (diff)
Check lengths of various string inputs and act accordingly in extreme cases.
Diffstat (limited to '')
-rwxr-xr-xtelem.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/telem.lua b/telem.lua
index 9646d84..9612a4b 100755
--- a/telem.lua
+++ b/telem.lua
@@ -130,9 +130,16 @@ function do_board()
if string.len(board) > 18 then
print("Board names must be 18 characters or less!")
return
+ elseif string.len(board) == 0 then
+ print("New board cancelled.")
+ return
end
- io.write("Description? ")
+ io.write("Board topic? (Max 48 chars)")
local desc = io.read()
+ if string.len(desc) > 48 then
+ print("Board topics must be 48 characters or less!")
+ return
+ end
-- Create directory
local board_dir = path.join(_BBS_ROOT, "boards", board)
lfs.mkdir(board_dir)
@@ -195,6 +202,9 @@ function do_new()
if string.len(subject) > 48 then
print("Thread subjects must be 48 characters or less!")
return
+ elseif string.len(subject) == 0 then
+ print("New thread cancelled.")
+ return
end
-- Save body of post to temp file
local filename = os.tmpname()