summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-03 20:52:03 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-03 20:52:03 +0100
commit0dd5c323fae7881577963ce77012e317db19af88 (patch)
tree81f506aa94b9d2816619ba0214faae706e5f0e5d
parentc87f7c334f4fef3279d7425a085f8279cd487f88 (diff)
downloadratpoison-0dd5c323fae7881577963ce77012e317db19af88.zip
In read_frame, don't silently ignore invalid/unknown frame selectors.
-rw-r--r--src/actions.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/actions.c b/src/actions.c
index f9be566..5ac17a2 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1769,7 +1769,6 @@ read_shellcmd (struct argspec *spec, struct sbuf *s, struct cmdarg **arg, const
return ret;
}
-/* Return NULL on abort/failure. */
static cmdret *
read_frame (struct sbuf *s, struct cmdarg **arg)
{
@@ -1851,16 +1850,21 @@ read_frame (struct sbuf *s, struct cmdarg **arg)
{
fnum = frame_selector_match (keysym_buf[0]);
if (fnum == -1)
- goto frame_fail;
+ return cmdret_new (RET_FAILURE, "unknown frame selector `%s'",
+ keysym_buf);
}
else
{
- goto frame_fail;
+ return cmdret_new (RET_FAILURE, "frame selector too long `%s'",
+ keysym_buf);
}
}
else
{
fnum = string_to_positive_int (sbuf_get (s));
+ if (fnum == -1)
+ return cmdret_new (RET_FAILURE, "invalid frame selector `%s',"
+ " negative or too big", sbuf_get (s));
}
/* Now that we have a frame number to go to, let's try to jump to
it. */
@@ -1876,11 +1880,8 @@ read_frame (struct sbuf *s, struct cmdarg **arg)
(*arg)->arg.frame = frame;
return NULL;
}
-
-
- frame_fail:
- *arg = NULL;
- return cmdret_new (RET_SUCCESS, NULL);
+ else
+ return cmdret_new (RET_FAILURE, "frame not found");
}
static cmdret *