summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-03 21:36:38 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-03 21:36:38 +0100
commitaec1e90984d3a3bdebdeeac790b4a664781f0929 (patch)
tree4768e7bb4675c83d8b35ae29f85ec9c498efb386
parent9d4e28028437349eddf6171df29863d9499efdb8 (diff)
downloadratpoison-aec1e90984d3a3bdebdeeac790b4a664781f0929.zip
Add error checking to set_padding and set_historysize.
-rw-r--r--src/actions.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c
index 57b3f58..4bc1b7d 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -3758,6 +3758,10 @@ set_historysize (struct cmdarg **args)
if (args[0] == NULL)
return cmdret_new (RET_SUCCESS, "%d", defaults.history_size);
+ if (ARG(0, number) < 0)
+ return cmdret_new (RET_FAILURE, "set historysize: %s",
+ invalid_negative_arg);
+
defaults.history_size = ARG(0, number);
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -3851,6 +3855,9 @@ set_padding (struct cmdarg **args)
r = ARG(2,number);
b = ARG(3,number);
+ if (l < 0 || t < 0 || r < 0 || b < 0)
+ return cmdret_new (RET_FAILURE, "set padding: %s", invalid_negative_arg);
+
/* Resize the frames to make sure they are not too big and not too
small. */
list_for_each_entry (frame,&(current_screen()->frames),node)