From 9d4e28028437349eddf6171df29863d9499efdb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Mon, 3 Mar 2014 21:35:49 +0100 Subject: Add error checking for various boolean (0|1) settings. --- src/actions.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/actions.c b/src/actions.c index 8a4fe8d..57b3f58 100644 --- a/src/actions.c +++ b/src/actions.c @@ -3768,6 +3768,9 @@ set_historycompaction (struct cmdarg **args) if (args[0] == NULL) return cmdret_new (RET_SUCCESS, "%d", defaults.history_compaction); + if (ARG(0, number) != 0 && ARG(0, number) != 1) + return cmdret_new (RET_FAILURE, "set historycompaction: invalid argument"); + defaults.history_compaction = ARG(0, number); return cmdret_new (RET_SUCCESS, NULL); } @@ -3782,6 +3785,10 @@ set_historyexpansion (struct cmdarg **args) return cmdret_new (RET_FAILURE, "Not compiled with libhistory"); } #endif + + if (ARG(0, number) != 0 && ARG(0, number) != 1) + return cmdret_new (RET_SUCCESS, "set historyexpansion: invalid argument"); + defaults.history_expansion = ARG(0, number); return cmdret_new (RET_SUCCESS, NULL); } @@ -3970,6 +3977,9 @@ set_waitcursor (struct cmdarg **args) if (args[0] == NULL) return cmdret_new (RET_SUCCESS, "%d", defaults.wait_for_key_cursor); + if (ARG(0,number) != 0 && ARG(0,number) != 1) + return cmdret_new (RET_FAILURE, "set waitcursor: invalid argument"); + defaults.wait_for_key_cursor = ARG(0,number); return cmdret_new (RET_SUCCESS, NULL); } -- cgit v1.2.3